Package amplee :: Package storage :: Module storedejavu :: Class DejavuStorage
[hide private]
[frames] | no frames]

Class DejavuStorage

source code

object --+    
         |    
   Storage --+
             |
            DejavuStorage

Instance Methods [hide private]
 
__init__(self, storage_type, config, base_unit=<class 'amplee.storage.storedejavu.DJMember'>, encoding='ISO-8859-1')
Dejavu storage for amplee.
source code
 
shutdown(self)
Shutdown the main dejavu arena object
source code
object
create_container(self, collection_name)
Register a new unit within the arena
source code
StorageResourceInfo or subclass
info(self, collection_name, resource_name=None)
Returns a StorageResourceInfo instance.
source code
object
get_content(self, info)
Returns the content of the resource.
source code
string
get_meta_data(self, info)
Returns the content of the resource.
source code
 
put_content(self, info, content, member_id, media_id, **kwargs)
Set the resource content of the unit instance
source code
 
put_meta_data(self, info, content, member_id, media_id, **kwargs)
Set the resource content of the unit instance
source code
 
remove_content(self, info)
Removes the resource from the storage
source code
 
remove_meta_data(self, info)
Removes the resource from the storage
source code
 
persist(self, *args, **kwargs)
Does nothing in this storage.
source code
bool
exists(self, info)
True if 'info' is valid False otherwise
source code
dict
ls(self, collection_name, ext=None)
List all the resources in a collection
source code
tuple
ils(self, collection_name, ext=None)
List all the resources in a collection
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, storage_type, config, base_unit=<class 'amplee.storage.storedejavu.DJMember'>, encoding='ISO-8859-1')
(Constructor)

source code 

Dejavu storage for amplee.

Keyword arguments storage_type -- string indicating what underlying engine to use by dejavu config -- a dictionnary of parameters to provide to dejavu for that storage_type base_unit -- base dejavu.Unit class to use when creating collection units

The base_unit must provide at least the same properties as DJMember and more if needed.
Overrides: object.__init__

shutdown(self)

source code 
Shutdown the main dejavu arena object
Overrides: Storage.shutdown

create_container(self, collection_name)

source code 

Register a new unit within the arena

This will create a table in your database with the name 'collection_name' and following the same schema as defined by the base_unit interface.

If it is already registered it will not create it.

Returns the newly created unit class.

Keyword argument collection_name -- name of the unit to create
Returns: object
the subclass may or may not return an object upon the creation of the container
Overrides: Storage.create_container

info(self, collection_name, resource_name=None)

source code 

Returns a StorageResourceInfo instance.

Keyword arguments collection_name -- collection name resource_name -- resource name to search for or None
Returns: StorageResourceInfo or subclass
an object representing the resource within the storage
Overrides: Storage.info

get_content(self, info)

source code 

Returns the content of the resource. Raises amplee.error.UnknownResource if info.key is None.

Keyword argument info -- as returned by info()
Returns: object
content of the resource
Overrides: Storage.get_content

get_meta_data(self, info)

source code 

Returns the content of the resource. Raises amplee.error.UnknownResource if info.key is None.

Keyword argument info -- as returned by info()
Returns: string
content of the atom entry
Overrides: Storage.get_meta_data

put_content(self, info, content, member_id, media_id, **kwargs)

source code 

Set the resource content of the unit instance

Automatically flushes modification to the storage.

Keyword arguments info -- as returned by info() If info.key is None then the unit is created is created.

content -- string object or a file object to dump into mb.media_content. In the latter case read() MUST return the full content as a byte string.

member_id -- as provided by member.member_id media_id -- as provided by member.media_id

collection_name -- collection storing the resource
Overrides: Storage.put_content

put_meta_data(self, info, content, member_id, media_id, **kwargs)

source code 

Set the resource content of the unit instance

Automatically flushes modification to the storage.

Keyword arguments info -- as returned by info() If info.key is None, it is created.

content -- string object or a file object to dump into mb.media_content. In the latter case read() MUST return the full content as a byte string.

member_id -- as provided by member.member_id

media_id -- as provided by member.media_id
Overrides: Storage.put_meta_data

remove_content(self, info)

source code 

Removes the resource from the storage

Keyword argument info -- as returned by info()
Overrides: Storage.remove_content

remove_meta_data(self, info)

source code 

Removes the resource from the storage

Keyword argument info -- as returned by info()
Overrides: Storage.remove_meta_data

persist(self, *args, **kwargs)

source code 
Does nothing in this storage.
Overrides: Storage.persist

exists(self, info)

source code 

True if 'info' is valid False otherwise

Keyword argument info -- as returned by info()
Returns: bool
True if the test succeeds, False otherwise.
Overrides: Storage.exists

ls(self, collection_name, ext=None)

source code 

List all the resources in a collection

Keyword arguments collection_name -- name of the storage unit
Returns: dict
a dictionnary of existing members, their identifier and a StorageResourceInfo instance representing the resource.
Overrides: Storage.ls

ils(self, collection_name, ext=None)

source code 

List all the resources in a collection

Keyword arguments collection_name -- name of the storage unit
Returns: tuple
existing members, their identifier and a StorageResourceInfo instance representing the resource.
Overrides: Storage.ils