Home | Trees | Index | Help |
|
---|
Package Modeling :: Module Database :: Class Database |
|
object
--+
|
Database
Snapshots and timestamps
While a Database object holds the snapshots and their timestamp, it is not the Database object's responsability to make decisions on whether a snapshot should be updated in a particular situation, or whatever decisions of that kind. Instead, other methods, such as AdaptorChannel.fetcObject() (refer to the documentation), make such decisions and then inform the Database (e.g. by actually recording snapshots)
Snapshots and referenceCounting:
__TBD
Snapshots related methods
- decrementSnapshotCountForGlobalID
- forgetAllSnapshots
- forgetSnapshotForGlobalID
- forgetSnapshotsForGlobalIDs
- incrementSnapshotCountForGlobalID
- recordSnapshotForGlobalID
- recordSnapshotForSourceGlobalID (toMany snapshots)
- recordSnapshots
- recordToManySnapshots (toMany snapshots)
- setTimestampToNow
- snapshotForGlobalID
- snapshotForSourceGlobalID (toMany snapshots)
- snapshots
Method Summary | |
---|---|
Initializer for Database. | |
Raises Unimplemented... | |
Returns the underlying 'Adaptor' object | |
Shortcut for 'addModelIfCompatible' | |
Before adding the model to the Database object, checks whether: | |
Database factory -- Equivalent to 'Database(anAdaptor=anAdaptor)' (Static method) | |
Database factory -- Equivalent to 'Database(aModel=aModel)' (Static method) | |
Decrement the corresponding snapshot's refCount ; if the refCount reaches 0 (zero) after decrementation, the corresponding snapshot is deleted. | |
Disables the snapshot refcounting in 'Databases' instances. (Static method) | |
entityForObject(self,
aDatabaseObject)
| |
Searches for the corresponding 'Entity' in the registered models and returns it, or 'None' if it cannot be found. | |
forgetAllSnapshots(self)
| |
Removes the snapshot registered for 'aGlobalID'. | |
Removes the snapshots registered for 'globalIDs'. | |
handleDroppedConnection(self)
| |
Increment the refCount for the corresponding snapshot by one. | |
Entity Caching is not supported yet | |
Entity Caching is not supported yet | |
Tells whether snapshot refCounting is enabled in 'Databases' instances. (Static method) | |
Releases the lock for this Database object | |
Returns the list of models managed by this 'Database' object | |
Records 'snapshot' for 'aGlobalID' ; the snapshot is time-stamped using the so-called current timestamp (see setTimestampToNow(), which is called by this method, as a side-effect) | |
recordSnapshotForSourceGlobalID(self,
gids,
aGlobalID,
aName)
| |
Records the supplied snapshots. | |
Records the snapshots for a toMany relationship. | |
Registers the supplied 'DatabaseContext' in the receiver. | |
Returns the registered 'DatabaseContext' objects | |
Remove 'aModel' from the list of models this Database object services. | |
Entity Caching is not supported yet | |
Entity Caching is not supported yet | |
Sets the current timestamp to 'time.time()', so that snapshots subsequently recorded are tagged with that current timestamp. | |
decrementSnapshotCountForGlobalID() | |
Returns the registered snapshot for the supplied GlobalID, if any. | |
snapshotForSourceGlobalID(self,
aGlobalID,
aName,
timestamp)
| |
Returns a dictionary containing all registered snapshots, where keys are 'GlobalIDs' and values=the corresponding snapshot. | |
Returns the current timestamp assigned to the snapshot for 'aGlobalID', or 'DistantPastTimeInterval' if no snapshot exists for 'aGlobalID'. | |
Returns the current timestamp assigned to the snapshot for 'aGlobalID', or 'DistantPastTimeInterval' if no snapshot exists for 'aGlobalID'. | |
Releases the lock for this Database object | |
Unregisters the supplied DatabaseContext from the receiver. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Class Variable Summary | |
---|---|
type |
SnapshotsTable = Modeling.Database.SnapshotsTable |
Instance Method Details |
---|
__init__(self,
anAdaptor=None,
aModel=None)
Initializer for Database. Parameters 'anAdaptor' and 'aModel' are
mutually exclusive: one, and only one, must be supplied at
initialization time. If this condition is not fulfilled 'AttributeError'
is raised. |
__unimplemented__(self)Raises Unimplemented... |
adaptor(self)Returns the underlying 'Adaptor' object |
addModel(self, aModel)Shortcut for 'addModelIfCompatible' |
addModelIfCompatible(self, aModel)Before adding the model to the Database object, checks whether:
If one of these checks fails, 'aModel' is not added and the method returns '0' (zero, i.e. false). Otherwise returns '1' (true) and adds 'aModel' to the list of registered models (if 'aModel' was already registered, it is not re-inserted but still, '1' is returned). |
decrementSnapshotCountForGlobalID(self, aGlobalID)Decrement the corresponding snapshot's refCount ; if the refCount reaches 0 (zero) after decrementation, the corresponding snapshot is deleted. If snapshot refcounting is disabled, this method does nothing. This method gets automatically called (see DatabaseContext.editingContextDidForgetObjectWithGlobalID()) |
entityNamed(self, entityName)Searches for the corresponding 'Entity' in the registered models and returns it, or 'None' if it cannot be found. |
forgetSnapshotForGlobalID(self, aGlobalID)Removes the snapshot registered for 'aGlobalID'. Raises 'ValueError' if no snapshots were registered for 'aGlobalID' |
forgetSnapshotsForGlobalIDs(self, globalIDs)Removes the snapshots registered for 'globalIDs'. Raises 'ValueError' if no snapshots were registered for at least one of GlobalID among 'globalIDs' ; WARNING: in that case, it is possible that some snapshots get actually forgotten before the exception is raised. |
incrementSnapshotCountForGlobalID(self, aGlobalID)Increment the refCount for the corresponding snapshot by one. If snapshot refcounting is disabled, this method does nothing. |
invalidateResultCache(self)Entity Caching is not supported yet |
invalidateResultCacheForEntityNamed(self, aName)Entity Caching is not supported yet |
lock(self)Releases the lock for this Database object |
models(self)Returns the list of models managed by this 'Database' object |
recordSnapshotForGlobalID(self, snapshot, aGlobalID)Records 'snapshot' for 'aGlobalID' ; the snapshot is time-stamped using the so-called current timestamp (see setTimestampToNow(), which is called by this method, as a side-effect) |
recordSnapshots(self, snapshots)Records the supplied snapshots. The snapshots are time-stamped using the current timestamp (calls setTimestampToNow()) Parameter: snapshots -- a dictionary whose keys are 'GlobalID' and values=corresponding snapshots |
recordToManySnapshots(self, snapshots)Records the snapshots for a toMany relationship. Parameter: snapshots -- a dictionary with GlobalIDs as keys and dictionary as values, the latter dictionary having relationships' names as keys and a list of GlobalIDs as values. |
registerContext(self, aDBContext)Registers the supplied 'DatabaseContext' in the receiver. Silently returns if 'aDBContext' was already registered. |
registeredContexts(self)Returns the registered 'DatabaseContext' objects |
removeModel(self, aModel)Remove 'aModel' from the list of models this Database object services. |
resultCacheForEntityNamed(self, aName)Entity Caching is not supported yet |
setResultCache(self, cache, aName)Entity Caching is not supported yet |
setTimestampToNow(self)Sets the current timestamp to 'time.time()', so that snapshots subsequently recorded are tagged with that current timestamp. |
snapshotCountForGlobalID(self, aGlobalID)
|
snapshotForGlobalID(self, aGlobalID, timestamp=0)Returns the registered snapshot for the supplied GlobalID, if any. Returns 'None' if none can be found, or if the registered snapshot's timestamp is lower than the supplied one. |
snapshots(self)Returns a dictionary containing all registered snapshots, where keys are 'GlobalIDs' and values=the corresponding snapshot. |
timestampForGlobalID(self, aGlobalID)Returns the current timestamp assigned to the snapshot for 'aGlobalID', or 'DistantPastTimeInterval' if no snapshot exists for 'aGlobalID'. |
timestampForSourceGlobalID(self, aGlobalID, aName)Returns the current timestamp assigned to the snapshot for 'aGlobalID', or 'DistantPastTimeInterval' if no snapshot exists for 'aGlobalID'. |
unlock(self)Releases the lock for this Database object |
unregisterContext(self, aDBContext)Unregisters the supplied DatabaseContext from the receiver. Raises 'ValueError' |
Static Method Details |
---|
databaseForAdaptor(anAdaptor)Database factory -- Equivalent to 'Database(anAdaptor=anAdaptor)' |
databaseForModel(aModel)Database factory -- Equivalent to 'Database(aModel=aModel)' |
disableSnapshotRefCounting()Disables the snapshot refcounting in 'Databases' instances. Note that once it has been disabled, the snapshot refcounting cannot be re-enabled. |
isSnapshotRefCountingEnabled()Tells whether snapshot refCounting is enabled in 'Databases' instances. Note that once it has been disabled, the snapshot refcounting cannot be re-enabled. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sat Mar 4 13:36:22 2006 | http://epydoc.sf.net |