Package amplee :: Package storage :: Class Storage
[hide private]
[frames] | no frames]

Class Storage

source code

object --+
         |
        Storage
Known Subclasses:
storedejavu.DejavuStorage, stores3.S3Storage, storetar.TarFileStorage, storememcache.StorageMemcache, storefs.FilesystemStorage, storesvn.SubversionStorage

Base storage class. Should not be instanciated

Instance Methods [hide private]
 
shutdown(self)
Shutdown the underlying storage connections
source code
object
create_container(self, name)
Creates a container within a storage if it doesn't already exist.
source code
StorageResourceInfo or subclass
info(self, collection_name, resource_name)
Returns an object allowing an access to the resource within the storage.
source code
object
get_content(self, info, *args, **kwargs)
Returns the content of a resource
source code
string
get_meta_data(self, info, *args, **kwargs)
Returns the atom entry representing the resource
source code
 
put_content(self, info, content, *args, **kwargs)
Puts the content of a resource
source code
 
put_meta_data(self, info, content, *args, **kwargs)
Sets the atom entry of a resource
source code
 
remove_content(self, info, *args, **kwargs)
Deletes a resource from the storage.
source code
 
remove_meta_data(self, info, *args, **kwargs)
Delete the atom entry from the storage
source code
 
persist(self, *args, **kwargs)
Persists the operations made
source code
bool
exists(self, info)
Checks whether or not info.key is valid for the storage
source code
dict
ls(self, collection_name_or_id, ext=None)
Returns existing members as a dictionnary of the form members[resource_name] = StorageResourceInfo instance.
source code
tuple
ils(self, collection_name_or_id, ext=None)
Yields existing members as a tuple of the form (resource_name, StorageResourceInfo instance)
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

create_container(self, name)

source code 
Creates a container within a storage if it doesn't already exist. A container means whatever is meaningful for the subclass storage. A directory in the filesystem storage, a OBTree in the ZODB storage, a table in a database storage.
Parameters:
  • name (string) - name of the container
Returns: object
the subclass may or may not return an object upon the creation of the container

info(self, collection_name, resource_name)

source code 
Returns an object allowing an access to the resource within the storage.
Parameters:
  • collection_name (string) - name of the collection
  • resource_name (string) - name of the resource
Returns: StorageResourceInfo or subclass
an object representing the resource within the storage

get_content(self, info, *args, **kwargs)

source code 
Returns the content of a resource
Parameters:
Returns: object
content of the resource

get_meta_data(self, info, *args, **kwargs)

source code 
Returns the atom entry representing the resource
Parameters:
Returns: string
content of the atom entry

put_content(self, info, content, *args, **kwargs)

source code 
Puts the content of a resource
Parameters:
  • info (StorageResourceInfo or subclass) - object representing the resource in the storage
  • content (string or fileobject) - content to store within the storage

put_meta_data(self, info, content, *args, **kwargs)

source code 
Sets the atom entry of a resource
Parameters:
  • info (StorageResourceInfo or subclass) - object representing the resource in the storage
  • content (string or fileobject) - content to store within the storage

remove_content(self, info, *args, **kwargs)

source code 
Deletes a resource from the storage.
Parameters:

remove_meta_data(self, info, *args, **kwargs)

source code 
Delete the atom entry from the storage
Parameters:

exists(self, info)

source code 
Checks whether or not info.key is valid for the storage
Parameters:
Returns: bool
True if the test succeeds, False otherwise.

ls(self, collection_name_or_id, ext=None)

source code 
Returns existing members as a dictionnary of the form members[resource_name] = StorageResourceInfo instance.
Parameters:
  • collection_name_or_id (string) - name of the collection to use for the listing
  • ext (string or NoneType) - extension to filter the members with during the listing
Returns: dict
a dictionnary of existing members, their identifier and a StorageResourceInfo instance representing the resource.

ils(self, collection_name_or_id, ext=None)

source code 
Yields existing members as a tuple of the form (resource_name, StorageResourceInfo instance)
Parameters:
  • collection_name_or_id (string) - name of the collection to use for the listing
  • ext (string or NoneType) - extension to filter the members with during the listing
Returns: tuple
existing members, their identifier and a StorageResourceInfo instance representing the resource.