Equalizer 1.0

co::InstanceCache Class Reference

Collaboration diagram for co::InstanceCache:

List of all members.

Classes

struct  Data
 One cache entry. More...
struct  Item

Public Member Functions

CO_API InstanceCache (const uint64_t maxSize=EQ_100MB)
 Construct a new instance cache.
CO_API ~InstanceCache ()
 Destruct this instance cache.
CO_API bool add (const ObjectVersion &rev, const uint32_t instanceID, Command &command, const uint32_t usage=0)
 Add a new command to the instance cache.
void remove (const NodeID &node)
 Remove all items from the given node.
CO_API const Dataoperator[] (const base::UUID &id)
 Direct access to the cached instance data for the given object id.
CO_API bool release (const base::UUID &id, const uint32_t count=1)
 Release the retrieved instance data of the given object.
CO_API bool erase (const base::UUID &id)
 Erase all the data for the given object.
uint64_t getSize () const
uint64_t getMaxSize () const
void expire (const int64_t age)
 Remove all items which are older than the given time.
bool empty ()

Detailed Description

Definition at line 35 of file instanceCache.h.


Constructor & Destructor Documentation

CO_API co::InstanceCache::InstanceCache ( const uint64_t  maxSize = EQ_100MB)

Construct a new instance cache.

CO_API co::InstanceCache::~InstanceCache ( )

Destruct this instance cache.


Member Function Documentation

CO_API bool co::InstanceCache::add ( const ObjectVersion rev,
const uint32_t  instanceID,
Command command,
const uint32_t  usage = 0 
)

Add a new command to the instance cache.

Parameters:
revthe object identifier and version.
instanceIDthe master instance ID.
commandThe command to add.
usagepre-set usage count.
Returns:
true if the command was entered, false if not.
CO_API bool co::InstanceCache::erase ( const base::UUID id)

Erase all the data for the given object.

The data does not have to be accessed, i.e., release has been called for each previous access.

Returns:
true if the element was erased, false otherwise.
void co::InstanceCache::expire ( const int64_t  age)

Remove all items which are older than the given time.

uint64_t co::InstanceCache::getMaxSize ( ) const [inline]
Returns:
the maximum number of bytes used by the instance cache.

Definition at line 109 of file instanceCache.h.

uint64_t co::InstanceCache::getSize ( ) const [inline]
Returns:
the number of bytes used by the instance cache.

Definition at line 106 of file instanceCache.h.

CO_API const Data& co::InstanceCache::operator[] ( const base::UUID id)

Direct access to the cached instance data for the given object id.

The instance data for the given object has to be released by the caller, unless 0 has been returned. Not all returned data stream might be ready.

Parameters:
idthe identifier of the object to look up.
Returns:
the list of cached instance datas, or Data::NONE if no data is cached for this object.
CO_API bool co::InstanceCache::release ( const base::UUID id,
const uint32_t  count = 1 
)

Release the retrieved instance data of the given object.

Parameters:
idthe identifier of the object to release.
countthe number of access operations to release
Returns:
true if the element was unpinned, false if it is not in the instance cache.
void co::InstanceCache::remove ( const NodeID node)

Remove all items from the given node.


The documentation for this class was generated from the following file:
Generated on Sun May 8 2011 19:11:08 for Equalizer 1.0 by  doxygen 1.7.3