#include <arcCacheST.h>
Public Member Functions | |
virtual long | getActiveCost () |
virtual long | getLockedCost () |
virtual long | getWorstValue (const TimeStamp ¤t) |
virtual long | removeWorst () |
virtual bool | maintainerStep (long &costChange) |
virtual long | getSleepTime (const TimeStamp ¤t, long minValue) |
virtual Cache * | clone () |
Creates a copy of the current cache. | |
Protected Member Functions | |
virtual void | clear (const StrategySelector &strSel) |
virtual CacheLock & | makePersistent (const StrategySelector &strSel, const PersIdentification &persId, DatabaseObject &objectPtr) |
virtual CacheLock & | getCacheLock (const StrategySelector &strSel, const PersIdentification &persId, bool rdonly=false) |
virtual void | dbDelete (const StrategySelector &strSel, const PersIdentification &persId) |
virtual void | cacheDelete (const StrategySelector &strSel, const PersIdentification &persId) |
virtual void | updateDirty (const StrategySelector &strSel) |
virtual void | removeAll (const StrategySelector &strSel) |
ArcCacheItem & | addLock (ArcCacheItem &item, bool rdonly) |
void | rmLock (ArcCacheItem &item) |
virtual bool | removeDoomed () |
virtual bool | removeZombie () |
virtual bool | asyncUpdate (long &costChange) |
Protected Attributes | |
MapType | cont |
void iopc::ArcCacheST< MapType >::clear | ( | const StrategySelector & | strSel | ) | [inline, protected, virtual] |
Synchronizes states of the cache and database. Removes all objects. Makes it possible to harmlessly break association of the cache and its connection. Uses strategy selector passed by caller.
strSel | The strategy selector. |
Implements iopc::ExtendedCache.
CacheLock & iopc::ArcCacheST< MapType >::makePersistent | ( | const StrategySelector & | strSel, | |
const PersIdentification & | persId, | |||
DatabaseObject & | objectPtr | |||
) | [inline, protected, virtual] |
Saves an object into database. Locks it in cache. Uses strategy selector passed by caller.
strSel | The strategy selector. | |
persId | ID of the object. | |
obj | Object to be made persistent. |
Implements iopc::ExtendedCache.
CacheLock & iopc::ArcCacheST< MapType >::getCacheLock | ( | const StrategySelector & | strSel, | |
const PersIdentification & | persId, | |||
bool | rdonly = false | |||
) | [inline, protected, virtual] |
Assures an object is in cache, locks it and returns an instance making it possible to access the object. Uses strategy selector passed by caller.
strSel | The strategy selector. | |
persId | ID of the object. | |
rdonly | Indicates the type of required access to the object (read-only/write). |
Implements iopc::ExtendedCache.
void iopc::ArcCacheST< MapType >::dbDelete | ( | const StrategySelector & | strSel, | |
const PersIdentification & | persId | |||
) | [inline, protected, virtual] |
Deletes an object. Uses strategy selector passed by caller.
strSel | The strategy selector. | |
persId | ID of the object. |
Implements iopc::ExtendedCache.
void iopc::ArcCacheST< MapType >::cacheDelete | ( | const StrategySelector & | strSel, | |
const PersIdentification & | persId | |||
) | [inline, protected, virtual] |
Represents a hint for the cache to remove local copy of an object. Can be ignored. Uses strategy selector passed by caller.
strSel | The strategy selector. | |
persId | ID of the object. |
Implements iopc::ExtendedCache.
void iopc::ArcCacheST< MapType >::updateDirty | ( | const StrategySelector & | strSel | ) | [inline, protected, virtual] |
Synchronize the state of cache and DB by updating the DB. Uses strategy selector passed by caller.
strSel | The strategy selector. |
Implements iopc::ExtendedCache.
void iopc::ArcCacheST< MapType >::removeAll | ( | const StrategySelector & | strSel | ) | [inline, protected, virtual] |
Synchronize the state of cache and DB by discarding all kept object (without modifications to DB).http://www-ucjf.troja.mff.cuni.cz/scheirich/comics/mff_life_09.jpg Uses strategy selector passed by caller.
strSel | The strategy selector. |
Implements iopc::ExtendedCache.
ArcCacheItem & iopc::ArcCacheST< MapType >::addLock | ( | ArcCacheItem & | item, | |
bool | rdonly | |||
) | [inline, protected, virtual] |
Adds a lock to an item containing an object
item | The item the lock should be added to. | |
rdonly | Type of the lock. |
Implements iopc::ArcCacheBase.
void iopc::ArcCacheST< MapType >::rmLock | ( | ArcCacheItem & | item | ) | [inline, protected, virtual] |
Removes one lock of an item representing an object
item | The item the lock should be removed from. |
Implements iopc::ArcCacheBase.
long iopc::ArcCacheST< MapType >::getActiveCost | ( | ) | [inline, virtual] |
Returns total cost of objects which can be removed from cache (i.e. are not locked).
Reimplemented from iopc::ExtendedCache.
long iopc::ArcCacheST< MapType >::getLockedCost | ( | ) | [inline, virtual] |
Returns total cost of objects which can't be removed from cache (i.e. are locked).
Reimplemented from iopc::ExtendedCache.
long iopc::ArcCacheST< MapType >::getWorstValue | ( | const TimeStamp & | current | ) | [inline, virtual] |
Returns value of the object having minimal value.
Reimplemented from iopc::ExtendedCache.
long iopc::ArcCacheST< MapType >::removeWorst | ( | ) | [inline, virtual] |
Removes the object with minimal value.
Reimplemented from iopc::ExtendedCache.
bool iopc::ArcCacheST< MapType >::maintainerStep | ( | long & | costChange | ) | [inline, virtual] |
Function executing one elementar maintenance step
Reimplemented from iopc::ExtendedCache.
long iopc::ArcCacheST< MapType >::getSleepTime | ( | const TimeStamp & | current, | |
long | minValue | |||
) | [inline, virtual] |
Gets the time it's possible to sleep for the external maintainer (unless it's woken up).
Reimplemented from iopc::ExtendedCache.
bool iopc::ArcCacheST< MapType >::removeDoomed | ( | ) | [inline, protected, virtual] |
Remove one object scheduled for deletion.
bool iopc::ArcCacheST< MapType >::removeZombie | ( | ) | [inline, protected, virtual] |
Removes one zombie. Zombies are created when an item can't removed from container because of the danger of deadlock.
bool iopc::ArcCacheST< MapType >::asyncUpdate | ( | long & | costChange | ) | [inline, protected, virtual] |
Updates one modified unlocked object.
costChange | Output parameter, the change of total cost caused by method call. |
MapType iopc::ArcCacheST< MapType >::cont [protected] |
Container holding items of all types - locked/unlocked, representing scheduled actions, modified, history, ...