Coverage for ion/core/data/store : 97.24%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
""" @file ion/data/store.py @package ion.data.IStore Pure virtual base class for CRUD @package ion.data.Store In-memory implementation of ion.data.IStore @author Michael Meisinger @author David Stuebe @author Dorian Raymer @brief base interface for all key-value stores in the system and default in memory implementation """
""" Interface all store backend implementations. All operations are returning deferreds and operate asynchronously.
@var namespace """
""" @param key an immutable key associated with a value @retval Deferred, for value associated with key, or None if not existing. """
""" @param key an immutable key to be associated with a value @param value an object to be associated with the key. The caller must not modify this object after it was @retval Deferred, for success of this operation """
""" @param key an immutable key associated with a value @retval Deferred, for success of this operation
"""
""" Memory implementation of an asynchronous key/value store, using a dict. Simulates typical usage of using a client connection to a backend technology. """
pass
""" @see IStore.get """
""" @see IStore.put """
""" @see IStore.remove """ # could test for existance of key. this will error otherwise
""" Checks to see if the key exists in the column family @param key is the key to check in the column family @retVal Returns a bool in a deferred """
""" Interface all store backend implementations. All operations are returning deferreds and operate asynchronously.
@var namespace """
""" @param key an immutable key associated with a value @retval Deferred, for value associated with key, or None if not existing. """
""" @param key an immutable key to be associated with a value @param value an object to be associated with the key. The caller must not modify this object after it was @param index_attributes a dictionary of attributes by which to index this value of this key @retval Deferred, for success of this operation """
""" @param key an immutable key associated with a value @retval Deferred, for success of this operation
"""
""" Search for rows in the Cassandra instance. @param query_predicates is a store.Query object @retVal a thrift representation of the rows returned by the query. """
""" @param key an immutable key associated with a value @param index_attributes an update to the dictionary of attributes by which to index this value of this key """
""" Checks to see if the key exists in the column family @param key is the key to check in the column family @retVal Returns a bool in a deferred """
""" Return the column names that are indexed. """
""" An exception class for the index store """
""" Memory implementation of an asynchronous key/value store, using a dict. Simulates typical usage of using a client connection to a backend technology.
@note self.kvs is a dictionary of dictionaries where the keys are row keys and the values are a dictionary representing the columns. The
{ key_1: {name_1:val_1, name_2:val2_1, ... name_n:val_n , key_2: {name_1:val_1, name_2:val2_1, ... name_n:val_n , ... key_n: {name_1:val_1, name_2:val2_1, ... name_n:val_n }
self.indices is an index to map attribute names to attribute values to keys {attr_names:{attr_value: set( keys)}}. """
#self.kvs = {} #self.indices = {}
""" @see IStore.get """ else:
""" @see IStore.put Raises an exception if index_attibutes contains attributes that are not indexed by the underlying store. """
""" @see IStore.remove """ # could test for existence of key. this will error otherwise
""" Search for rows in the Cassandra instance.
@param indexed_attributes is a dictionary with column:value mappings. Rows are returned that have columns set to the value specified in the dictionary
@retVal A data structure representing Cassandra rows. See the class docstring for the description of the data structure. """
raise IndexStoreError('Invalid arguments to IndexStore - must provide at least one equal to operator for search!') else:
#log.debug("keys: "+ str(keys)) # This is stupid, but now remove effectively works - delete keys are no longer visible!
#Ensure that we are updating attributes that are indexed.
# Create a set of keys if it does not already exist
#if not kindex: # kindex = {} # self.indices[k] = kindex # Create a set of keys if it does not already exist
""" @brief Update the index attributes, but keep the value the same. @param key The key to the row. @param index_attributes A dictionary of column names and values. These attributes can be used to query the store to return rows based on the value of the attributes.
Raises an IndexStoreException if you try to update an attribute that is not indexed. """
""" Checks to see if the key exists in the column family @param key is the key to check in the column family @retVal Returns a bool in a deferred """
""" Return the column names that are indexed. """
""" Class that holds the predicates used to query an IndexStore. """
def __repr__(self): res = '' for item in self._predicates: res += str(item) + '\n' return res
""" @note Proposed class to fulfill preservation service management? @brief Administrative functionality for backend store configuration. """ """ @brief Create a separate organizational instance in the backend @param persistent_archive is the name of the organization @retval succeed or fail """
""" @brief Remove an organizational instance in the backend @param persistent_archive is the name of the organization """
""" @brief changes the configuration of the persistent archive @param persistent_archive the name and configuration of the persistent archive. This is represented as an OOI resource. """
""" @brief creates a new cache in Cassandra this creates a new column family @param persistent_archive the archive in which the cache resides @param cache a resource representation of the cache, this includes its name and configuration """
""" @brief changes the configuration of the current cache @param a resource representation of the cache """
""" @brief remove the current cache @param a resource representation of the cache """
""" Memory implementation of the IDataManager interface. This conforms to the interface, but does nothing. """
""" @brief Create a separate organizational instance in the backend @param persistent_archive the name and configuration of the persistent archive. @retval succeed or fail """
""" @brief Remove an organizational instance in the backend @param persistent_archive is the name of the organization """
""" @brief changes the configuration of the persistent archive @param persistent_archive the name and configuration of the persistent archive. This is represented as an OOI resource. """
""" @brief creates a new cache in Cassandra this creates a new column family @param persistent_archive the archive in which the cache resides @param cache a resource representation of the cache, this includes its name and configuration """
""" @brief changes the configuration of the current cache @param a resource representation of the cache """
""" @brief remove the current cache @param persistent_archive the name and configuration of the persistent archive. @param a resource representation of the cache """
""" All store client connections need: - host - port All stores have: - namespace
See if a generic process TCP connector makes sense. Any implementation of IStore must operate in the ion framework, and therefore it only makes sense for the life cycle of the class instance and the connection of the backend client to be carried out in concert with an ion process. """
""" @param process the process instance """ self.host = host self.port = port self.process = process
|