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'>)
Dejavu storage for amplee.
  shutdown(self)
...
  create_container(self, collection_name)
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.
  path(self, *args, **kwargs)
Returns a unit instance or None if it could not be found in the storage.
  get_content(self, mb)
...
  get_meta_data(self, mb)
...
  put_content(self, mb, content, member_id, media_id, collection_name, **kwargs)
Set the resource content of the unit instance Automatically flushes modification to the storage.
  put_meta_data(self, mb, content, member_id, media_id, collection_name, **kwargs)
Set the resource content of the unit instance Automatically flushes modification to the storage.
  remove_content(self, mb)
...
  remove_meta_data(self, mb)
...
  persist(self, *args, **kwargs)
Does nothing in this storage.
  exists(self, mb)
...
  ls(self, collection_name, ext)
List resources with the provided extension in a collection Returns a dictionary like this: members[basename(abs_path)] = {'path': abs_path} Keyword arguments collection_name -- name of the storage unit containing all the members of a collection.

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'>)
(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

Overrides: Storage.create_container

path(self, *args, **kwargs)

source code 

Returns a unit instance or None if it could not be found
in the storage.

Keyword arguments
args[0] -- collection name
args[1] -- resource name to search for or None

Overrides: Storage.path

get_content(self, mb)

source code 

Returns the content of the resource

Keyword argument
mb -- as returned by get_path

Overrides: Storage.get_content

get_meta_data(self, mb)

source code 

Returns the content (UTF-8 encoded) of the resource

Keyword argument
mb -- as returned by get_path

Overrides: Storage.get_meta_data

put_content(self, mb, content, member_id, media_id, collection_name, **kwargs)

source code 

Set the resource content of the unit instance

Automatically flushes modification to the storage.

Keyword arguments
mb -- Unit instance as returned by get_path or None.
If None, mb is created.
content -- string object to dump into mb.media_content
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, mb, content, member_id, media_id, collection_name, **kwargs)

source code 

Set the resource content of the unit instance

Automatically flushes modification to the storage.

Keyword arguments
mb -- Unit instance as returned by get_path or None.
If None, mb is created.
content -- string object to dump into mb.member_content
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_meta_data

remove_content(self, mb)

source code 

Removes the resource from the storage

Keyword argument
mb -- Unit instance as returned by get_path

Overrides: Storage.remove_content

remove_meta_data(self, mb)

source code 

Removes the resource from the storage

Keyword argument
mb -- Unit instance as returned by get_path

Overrides: Storage.remove_meta_data

persist(self, *args, **kwargs)

source code 

Does nothing in this storage.

Overrides: Storage.persist

exists(self, mb)

source code 

True if mb is valid
False otherwise

Keyword argument
mb -- Unit instance as returned by get_path

Overrides: Storage.exists

ls(self, collection_name, ext)

source code 

List resources with the provided extension in a collection
Returns a dictionary like this:

members[basename(abs_path)] = {'path': abs_path}

Keyword arguments
collection_name -- name of the storage unit 
containing all the members of a collection. Created if it does
not exists.
ext -- unused

Overrides: Storage.ls