Package Ganga :: Package Core :: Package GangaRepository :: Module Registry :: Class Registry
[hide private]
[frames] | no frames]

Class Registry

source code

object --+
         |
        Registry
Known Subclasses:

Ganga Registry Base class providing a dict-like locked and lazy-loading interface to a Ganga repository

Instance Methods [hide private]
 
__init__(self, name, doc, dirty_flush_counter=10, update_index_time=30)
Registry constructor, giving public name and documentation
source code
 
__getitem__(self, id)
Returns the Ganga Object with the given id.
source code
 
__len__(self)
Returns the current number of root objects
source code
 
__contains__(self, id)
Returns True if the given ID is in the registry
source code
 
ids(self)
Returns the list of ids of this registry
source code
 
items(self)
Return the items (ID,obj) in this registry.
source code
 
iteritems(self)
Return the items (ID,obj) in this registry.
source code
 
keys(self)
Returns the list of ids of this registry
source code
 
values(self)
Return the objects in this registry, in order of ID.
source code
 
__iter__(self) source code
 
find(self, obj)
Returns the id of the given object in this registry, or Raise ObjectNotInRegistryError if the Object is not found
source code
 
clean(self, force=False)
Deletes all elements of the registry, if no other sessions are present.
source code
 
_add(self, obj, force_index=None)
Add an object to the registry and assigns an ID to it.
source code
 
_remove(self, obj, auto_removed=0)
Private method removing the obj from the registry.
source code
 
_dirty(self, obj)
Mark an object as dirty.
source code
 
_flush(self, objs=[])
Flush a set of objects to the persistency layer immediately Raise RepositoryError Raise RegistryAccessError Raise RegistryLockError
source code
 
_read_access(self, obj, sub_obj=None)
Obtain read access on a given object.
source code
 
_write_access(self, obj)
Obtain write access on a given object.
source code
 
_release_lock(self, obj)
Release the lock on a given object.
source code
 
pollChangedJobs(self, name)
Returns a list of job ids that changed since the last call of this function.
source code
 
getIndexCache(self, obj)
Returns a dictionary to be put into obj._index_cache This can and should be overwritten by derived Registries to provide more index values.
source code
 
startup(self)
Connect the repository to the registry.
source code
 
shutdown(self)
Flush and disconnect the repository.
source code
 
info(self, full=False)
Returns an informative string onFlush and disconnect the repository.
source code
 
print_other_sessions(self) source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, doc, dirty_flush_counter=10, update_index_time=30)
(Constructor)

source code 

Registry constructor, giving public name and documentation

Overrides: object.__init__

__getitem__(self, id)
(Indexing operator)

source code 

Returns the Ganga Object with the given id. Raise RegistryKeyError

items(self)

source code 

Return the items (ID,obj) in this registry. Recommended access for iteration, since accessing by ID can fail if the ID iterator is old

values(self)

source code 

Return the objects in this registry, in order of ID. Besides items() this is also recommended for iteration.

clean(self, force=False)

source code 

Deletes all elements of the registry, if no other sessions are present. if force == True it removes them regardless of other sessions. Returns True on success, False on failure.

_add(self, obj, force_index=None)

source code 

Add an object to the registry and assigns an ID to it. use force_index to set the index (for example for metadata). This overwrites existing objects! Raises RepositoryError

_remove(self, obj, auto_removed=0)

source code 

Private method removing the obj from the registry. This method always called. This method may be overriden in the subclass to trigger additional actions on the removal. 'auto_removed' is set to true if this method is called in the context of obj.remove() method to avoid recursion. Only then the removal takes place. In the opposite case the obj.remove() is called first which eventually calls this method again with "auto_removed" set to true. This is done so that obj.remove() is ALWAYS called once independent on the removing context. Raise RepositoryError Raise RegistryAccessError Raise RegistryLockError Raise ObjectNotInRegistryError

_dirty(self, obj)

source code 

Mark an object as dirty. Trigger automatic flush after specified number of dirty hits Raise RepositoryError Raise RegistryAccessError Raise RegistryLockError

_read_access(self, obj, sub_obj=None)

source code 

Obtain read access on a given object. sub-obj is the object the read access is actually desired (ignored at the moment) Raise RegistryAccessError Raise RegistryKeyError

_write_access(self, obj)

source code 

Obtain write access on a given object. Raise RepositoryError Raise RegistryAccessError Raise RegistryLockError Raise ObjectNotInRegistryError

_release_lock(self, obj)

source code 

Release the lock on a given object. Raise RepositoryError Raise RegistryAccessError Raise ObjectNotInRegistryError

pollChangedJobs(self, name)

source code 

Returns a list of job ids that changed since the last call of this function. On first invocation returns a list of all ids. "name" should be a unique identifier of the user of this information.

startup(self)

source code 

Connect the repository to the registry. Called from Repository_runtime.py

shutdown(self)

source code 

Flush and disconnect the repository. Called from Repository_runtime.py

info(self, full=False)

source code 

Returns an informative string onFlush and disconnect the repository. Called from Repository_runtime.py