Sirikata
|
A read-only iterator. More...
#include <CacheMap.hpp>
Public Member Functions | |
read_iterator (CacheMap &m) | |
Construct from a CacheMap (contains a scoped read lock) | |
operator bool () const | |
bool | iterate () |
bool | find (const Fingerprint &id) |
Moves this iterator to id. | |
CacheData | operator* () const |
const Fingerprint & | getId () const |
cache_usize_type | getSize () const |
PolicyData | getPolicyInfo () |
void | use () |
Sets the use bit in the corresponding cache policy. | |
Private Attributes | |
CacheMap * | mCachemap |
boost::shared_lock < boost::shared_mutex > | mLock |
MapClass * | mMap |
MapClass::iterator | mIter |
A read-only iterator.
Not const because the LRU use-count is allowed to be updated, even though the CacheLayer cannot be changed. A read_iterator locks the map using a boost::shared_lock. This means that any number of read_iterator objects are allowed access at the same time, except when a write_iterator is in use.
Sirikata::Transfer::CacheMap::read_iterator::read_iterator | ( | CacheMap & | m | ) | [inline] |
Construct from a CacheMap (contains a scoped read lock)
bool Sirikata::Transfer::CacheMap::read_iterator::find | ( | const Fingerprint & | id | ) | [inline] |
Moves this iterator to id.
id | what to search for |
Referenced by Sirikata::Transfer::MemoryCacheLayer::getData(), Sirikata::Transfer::DiskCacheLayer::getData(), and Sirikata::Transfer::DiskCacheLayer::workerThread().
const Fingerprint& Sirikata::Transfer::CacheMap::read_iterator::getId | ( | ) | const [inline] |
Referenced by use().
PolicyData Sirikata::Transfer::CacheMap::read_iterator::getPolicyInfo | ( | ) | [inline] |
Referenced by use().
cache_usize_type Sirikata::Transfer::CacheMap::read_iterator::getSize | ( | ) | const [inline] |
Referenced by use().
Sirikata::Transfer::CacheMap::read_iterator::operator bool | ( | ) | const [inline] |
CacheData Sirikata::Transfer::CacheMap::read_iterator::operator* | ( | ) | const [inline] |
void Sirikata::Transfer::CacheMap::read_iterator::use | ( | ) | [inline] |
Sets the use bit in the corresponding cache policy.
References getId(), getPolicyInfo(), getSize(), mCachemap, Sirikata::Transfer::CacheMap::mPolicy, and Sirikata::Transfer::CachePolicy::use().
Referenced by Sirikata::Transfer::DiskCacheLayer::getData().
Referenced by use().
MapClass::iterator Sirikata::Transfer::CacheMap::read_iterator::mIter [private] |
Referenced by find(), iterate(), and operator bool().
boost::shared_lock<boost::shared_mutex> Sirikata::Transfer::CacheMap::read_iterator::mLock [private] |
Referenced by find(), iterate(), and operator bool().