Home | Trees | Index | Help |
---|
Package twisted :: Package popsicle :: Module repos :: Class Repository |
|
DirectoryRepository
A data storage that can be loaded from. A repository of objects.
I am an abstract class. Subclass me and implement 'loadOID' and 'saveOID'
Note that 'Repository' implementations are really open-ended. This implementation strategy is suggested, though, and it is strongly suggested that authors of new repositories implement at least the caching shown here.
However, facilities such as ad-hoc querying are omitted from this interface, and should be provided by e.g. an SQL Repository implementation.
A repository is both a saver and a collection of PersistentReferences.Method Summary | |
---|---|
Initialize me (set up cache). | |
__getstate__(self)
| |
__setstate__(self,
dct)
| |
Weakly cache an object for the given OID. | |
The freezer finished cleaning, and some of my objects were cleaned. | |
Create an instance with an oid and cache it. | |
Generate an OID synchronously. | |
getOID(self,
obj)
| |
Load an object from cache or by OID. | |
External API for synchronously loading stuff. | |
Implement me to return a Deferred if you want to implement asynchronous loading. | |
Implement me if you want to implement synchronous loading. | |
Synonymous with ref.__call__(). | |
Save an object... | |
Return a Deferred which will fire True when the object is saved. | |
_cbLoadedOID(self,
result,
oid,
pref)
|
Class Variable Summary | |
---|---|
class |
ISaver
|
int |
_lastOID
|
Method Details |
---|
__init__(self)
Initialize me (set up cache).
|
cache(self, oid, obj, finished=1)Weakly cache an object for the given OID. This means I own it, so also register it with the Freezer as such. |
cleaned(self)The freezer finished cleaning, and some of my objects were cleaned. |
createOID(self, oid, klass)Create an instance with an oid and cache it. This is useful during loading. |
generateOID(self, obj)Generate an OID synchronously. Necessary for some types of persistence, but |
load(self, oid)Load an object from cache or by OID. Return a Deferred. This method should be called by external objects looking for a 'starting point' into the repository. |
loadNow(self, oid)External API for synchronously loading stuff. This should ONLY BE USED by code that is doing the actual loading/saving of structured objects. Application code should always make calls through PersistentReference.__call__, otherwise it will not work on some back-ends. |
loadOID(self, oid)Implement me to return a Deferred if you want to implement asynchronous loading. |
loadOIDNow(self, oid)Implement me if you want to implement synchronous loading. |
loadRef(self, pRef)Synonymous with ref.__call__(). |
save(self, obj)Save an object... If this is the first time I am saving this particular object, I need to locate a new unique ID for it. |
saveOID(self, oid, obj)Return a Deferred which will fire True when the object is saved. |
Class Variable Details |
---|
ISaverISaver = twisted.popsicle.freezer.ISaver
|
_lastOID
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 1.1 on Thu May 8 13:18:35 2003 | http://epydoc.sf.net |