#include <arcCache.h>
void iopc::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< 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::ArcCache< MapType >::getWorstValue | ( | const TimeStamp & | current | ) | [inline, virtual] |
Returns value of the object having minimal value.
Reimplemented from iopc::ExtendedCache.
long iopc::ArcCache< MapType >::removeWorst | ( | ) | [inline, virtual] |
Removes the object with minimal value.
Reimplemented from iopc::ExtendedCache.
bool iopc::ArcCache< MapType >::maintainerStep | ( | long & | costChange | ) | [inline, virtual] |
Function executing one elementar maintenance step
Reimplemented from iopc::ExtendedCache.
long iopc::ArcCache< 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::ArcCache< MapType >::removeDoomed | ( | ) | [inline, protected, virtual] |
Remove one object scheduled for deletion.
bool iopc::ArcCache< 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::ArcCache< 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::ArcCache< MapType >::cont [protected] |
Container holding items of all types - locked/unlocked, representing scheduled actions, modified, history, ...
RWLock iopc::ArcCache< MapType >::contLock [protected] |
Locks items in container.
Mutex iopc::ArcCache< MapType >::listLock [protected] |
Common lock needed when modifying lists.
CondVar iopc::ArcCache< MapType >::busyCond [protected] |
Conditional for signaling state change from ST_BUSY to something else.
long iopc::ArcCache< MapType >::rActiveCnt [protected] |
Number of unlocked objects (recent).
long iopc::ArcCache< MapType >::rLockedCnt [protected] |
Number of locked objects (recent).
long iopc::ArcCache< MapType >::fActiveCnt [protected] |
Number of unlocked objects (frequent).
long iopc::ArcCache< MapType >::fLockedCnt [protected] |
Number of locked objects (frequent).
long iopc::ArcCache< MapType >::rHistCnt [protected] |
Number of items representing history (recent).
long iopc::ArcCache< MapType >::fHistCnt [protected] |
Number of items representing history (frequent).
ArcCacheItem iopc::ArcCache< MapType >::rCleanList [protected] |
List of objects which doesn't require async update (recent).
ArcCacheItem iopc::ArcCache< MapType >::rHistList [protected] |
List of history records (recent).
ArcCacheItem iopc::ArcCache< MapType >::rDirtyList [protected] |
List of objects requiring async update (recent).
ArcCacheItem iopc::ArcCache< MapType >::fCleanList [protected] |
List of objects which doesn't require async update (frequent).
ArcCacheItem iopc::ArcCache< MapType >::fHistList [protected] |
List of history records (frequent).
ArcCacheItem iopc::ArcCache< MapType >::fDirtyList [protected] |
List of objects requiring async update (frequent).
ArcCacheItem iopc::ArcCache< MapType >::doomedList [protected] |
List of items scheduled for deletion.
ArcCacheItem iopc::ArcCache< MapType >::zombieList [protected] |
List of zombies.
long iopc::ArcCache< MapType >::activeCost [protected] |
Total cost of unlocked items (recent and frequent).
long iopc::ArcCache< MapType >::lockedCost [protected] |
Total cost of locked items (recent and frequent).
double iopc::ArcCache< MapType >::target [protected] |
Target for ratio activeCost/lockedCost.