NCBI C++ ToolKit
Classes | Typedefs | Enumerations | Enumerator | Functions | Variables | Friends
BDB library BLOB Cache
+ Collaboration diagram for BDB library BLOB Cache:

Classes

struct  SCache_AttrDB
 BLOB attributes DB. More...
 
struct  SCache_IdIDX
 BLOB ID -> key, value, subkey index. More...
 
struct  SBDB_TimeAccessStatistics
 BDB cache access statistics. More...
 
struct  SBDB_CacheUnitStatistics
 BDB cache statistics (covers one elemntary unit of measurements) More...
 
class  SBDB_CacheStatistics
 BDB cache statistics. More...
 
class  CBDB_Cache
 BDB cache implementation. More...
 
struct  CBDB_Cache::CacheKey
 Cache accession for internal in-memory storage. More...
 
class  CBDB_CacheHolder
 Class container for BDB cache objects. More...
 

Typedefs

typedef map< unsigned, unsigned > SBDB_CacheUnitStatistics::TBlobSizeHistogram
 Blob size to number of blobs. More...
 
typedef deque< SBDB_TimeAccessStatisticsSBDB_CacheUnitStatistics::TTimeAccess
 
typedef map< string, SBDB_CacheUnitStatisticsSBDB_CacheStatistics::TOwnerStatMap
 
typedef bm::bvector CBDB_Cache::TBitVector
 
typedef CBDB_BlobSplitStore< TBitVector, CBDB_BlobDeMux_RoundRobin, CFastMutexCBDB_Cache::TSplitStore
 Split store for BLOBs. More...
 
typedef CLockVector< TBitVectorCBDB_Cache::TLockVector
 
typedef CLockVectorGuard< TLockVectorCBDB_Cache::TBlobLock
 
typedef CTimeLine< TBitVectorCBDB_Cache::TTimeLine
 

Enumerations

enum  SBDB_CacheUnitStatistics::EErrGetPut { SBDB_CacheUnitStatistics::eErr_Unknown , SBDB_CacheUnitStatistics::eErr_Put , SBDB_CacheUnitStatistics::eErr_Get }
 Put/Get errors. More...
 
enum  CBDB_Cache::EWriteSyncMode { CBDB_Cache::eWriteSync , CBDB_Cache::eWriteNoSync }
 Suggest page size. More...
 
enum  CBDB_Cache::ELockMode { CBDB_Cache::eNoLock , CBDB_Cache::ePidLock }
 Locking modes to protect cache instance. More...
 
enum  CBDB_Cache::ETRansact { CBDB_Cache::eUseTrans , CBDB_Cache::eNoTrans }
 Underlying BDB database can be configured using transactional or non-transactional API. More...
 
enum  CBDB_Cache::EBlobAccessType { CBDB_Cache::eBlobStore , CBDB_Cache::eBlobUpdate , CBDB_Cache::eBlobRead }
 access type for "UpdateAccessTime" methods More...
 
enum  CBDB_Cache::EBlobCheckinMode { CBDB_Cache::eBlobCheckIn , CBDB_Cache::eBlobCheckIn_Create }
 BLOB check-in mode. More...
 
enum  CBDB_Cache::EBlobCheckinRes { CBDB_Cache::EBlobCheckIn_NotFound , CBDB_Cache::eBlobCheckIn_Found , CBDB_Cache::eBlobCheckIn_Created }
 Result of BLOB check-in process. More...
 

Functions

void BDB_Register_Cache (void)
 Register NCBI_BDB_ICacheEntryPoint. More...
 
 SCache_AttrDB::SCache_AttrDB ()
 
 SCache_IdIDX::SCache_IdIDX ()
 
 SBDB_TimeAccessStatistics::SBDB_TimeAccessStatistics (unsigned d, unsigned hr, unsigned put, unsigned get)
 
 SBDB_CacheUnitStatistics::SBDB_CacheUnitStatistics ()
 
void SBDB_CacheUnitStatistics::Init ()
 
void SBDB_CacheUnitStatistics::AddStore (time_t tm, unsigned store, unsigned update, unsigned blob_size, unsigned overflow)
 
void SBDB_CacheUnitStatistics::AddRead (time_t tm)
 
void SBDB_CacheUnitStatistics::AddExplDelete ()
 
void SBDB_CacheUnitStatistics::AddPurgeDelete ()
 
void SBDB_CacheUnitStatistics::AddNeverRead ()
 
void SBDB_CacheUnitStatistics::AddInternalError (EErrGetPut operation)
 
void SBDB_CacheUnitStatistics::AddProtocolError (EErrGetPut operation)
 
void SBDB_CacheUnitStatistics::AddNoBlobError (EErrGetPut operation)
 
void SBDB_CacheUnitStatistics::AddCommError (EErrGetPut operation)
 
void SBDB_CacheUnitStatistics::AddBlobQuotaError ()
 
static void SBDB_CacheUnitStatistics::AddToHistogram (TBlobSizeHistogram *hist, unsigned size)
 
void SBDB_CacheUnitStatistics::ConvertToRegistry (IRWRegistry *reg, const string &sect_name_postfix) const
 Convert statistics into registry sections and entries. More...
 
void SBDB_CacheUnitStatistics::PrintStatistics (CNcbiOstream &out) const
 
void SBDB_CacheUnitStatistics::InitHistorgam (TBlobSizeHistogram *hist)
 
void SBDB_CacheUnitStatistics::x_AddErrGetPut (EErrGetPut operation)
 
 SBDB_CacheStatistics::SBDB_CacheStatistics ()
 
void SBDB_CacheStatistics::Init ()
 Drop all collected statistics. More...
 
void SBDB_CacheStatistics::AddStore (const string &client, time_t tm, unsigned store, unsigned update, unsigned blob_size, unsigned overflow)
 
void SBDB_CacheStatistics::AddRead (const string &client, time_t tm)
 
void SBDB_CacheStatistics::AddExplDelete (const string &client)
 
void SBDB_CacheStatistics::AddPurgeDelete (const string &client)
 
void SBDB_CacheStatistics::AddNeverRead (const string &client)
 
void SBDB_CacheStatistics::AddInternalError (const string &client, SBDB_CacheUnitStatistics::EErrGetPut operation)
 
void SBDB_CacheStatistics::AddProtocolError (const string &client, SBDB_CacheUnitStatistics::EErrGetPut operation)
 
void SBDB_CacheStatistics::AddNoBlobError (const string &client, SBDB_CacheUnitStatistics::EErrGetPut operation)
 
void SBDB_CacheStatistics::AddCommError (const string &client, SBDB_CacheUnitStatistics::EErrGetPut operation)
 
void SBDB_CacheStatistics::AddBlobQuotaError (const string &client)
 
void SBDB_CacheStatistics::ConvertToRegistry (IRWRegistry *reg) const
 
void SBDB_CacheStatistics::PrintStatistics (CNcbiOstream &out) const
 
SBDB_CacheUnitStatisticsSBDB_CacheStatistics::GlobalStatistics ()
 
 CBDB_Cache::CBDB_Cache ()
 
virtual CBDB_Cache::~CBDB_Cache ()
 
void CBDB_Cache::SetWriteSync (EWriteSyncMode wsync)
 Set write syncronization. More...
 
EWriteSyncMode CBDB_Cache::GetWriteSync () const
 
void CBDB_Cache::RunPurgeThread (unsigned purge_delay=30)
 Schedule a background Purge thread (cleans the cache from the obsolete entries) SetPurgeBatchSize and SetBatchSleep should be used to regulate the thread priority. More...
 
void CBDB_Cache::StartPurgeThread ()
 Start background thread. More...
 
void CBDB_Cache::StopPurgeThread ()
 Stop background thread. More...
 
void CBDB_Cache::Open (const string &cache_path, const string &cache_name, ELockMode lm=eNoLock, Uint8 cache_ram_size=0, ETRansact use_trans=eUseTrans, unsigned int log_mem_size=0)
 Open local cache instance (read-write access) If cache does not exists it is created. More...
 
void CBDB_Cache::Verify (const string &cache_path, const string &cache_name, const string &err_file=0, bool force_remove=false)
 Run verification of the cache database. More...
 
void CBDB_Cache::OpenReadOnly (const string &cache_path, const string &cache_name, unsigned int cache_ram_size=0)
 Open local cache in read-only mode. More...
 
CBDB_EnvCBDB_Cache::GetEnv ()
 Get environment. More...
 
bool CBDB_Cache::IsJoinedEnv ()
 Return true if environment is not created but joined. More...
 
void CBDB_Cache::Close ()
 
bool CBDB_Cache::IsReadOnly () const
 Return TRUE if cache is read-only. More...
 
void CBDB_Cache::SetMonitor (IServer_Monitor *monitor)
 Set monitor (class does NOT take ownership) More...
 
IServer_MonitorCBDB_Cache::GetMonitor ()
 Get monitor. More...
 
void CBDB_Cache::SetReadUpdateLimit (unsigned)
 Set update attribute limit (0 by default) More...
 
void CBDB_Cache::CleanLog ()
 Remove all non-active LOG files. More...
 
void CBDB_Cache::SetLogFileMax (unsigned fl_size)
 Set transaction log file size. More...
 
void CBDB_Cache::SetLogDir (const string &log_dir)
 Transaction log directory. More...
 
void CBDB_Cache::SetInitIfDirty (bool value)
 
void CBDB_Cache::SetPurgeBatchSize (unsigned batch_size)
 Number of records in scanned at once by Purge Cache is exclusively locks an internal mutex while scanning the batch and all other threads is getting locked. More...
 
unsigned CBDB_Cache::GetPurgeBatchSize () const
 
void CBDB_Cache::SetBatchSleep (unsigned sleep)
 Set sleep in milliseconds between Purge batches (for low priority Purge processes) More...
 
unsigned CBDB_Cache::GetBatchSleep () const
 
void CBDB_Cache::StopPurge ()
 Request to stop Purge. More...
 
void CBDB_Cache::CleanLogOnPurge (unsigned int factor)
 When factor is non zero every factor-even Purge will remove old log files. More...
 
void CBDB_Cache::SetCheckpoint (unsigned int bytes)
 Checkpoint the database at least as often as every bytes of log file are written. More...
 
void CBDB_Cache::SetCheckpointDelay (unsigned int delay)
 Checkpoint the database every 'delay' minutes. More...
 
void CBDB_Cache::SetOverflowLimit (unsigned limit)
 
unsigned CBDB_Cache::GetOverflowLimit () const
 
void CBDB_Cache::SetTTL_Prolongation (unsigned ttl_prolong)
 Maximum limit for read updates (blob expires eventually even if it is accessed) 0 - unlimited prolongation (default) More...
 
unsigned CBDB_Cache::GetTTL_Prolongation () const
 Get max limit for read update. More...
 
void CBDB_Cache::SetMaxBlobSize (unsigned max_size)
 Set max allowed BLOB size. More...
 
unsigned CBDB_Cache::GetMaxBlobSize () const
 Get max allowed BLOB size. More...
 
void CBDB_Cache::SetRR_Volumes (unsigned rrv)
 Set number of rotated round-robin volumes. More...
 
void CBDB_Cache::SetMempTrickle (unsigned memp_trickle)
 Set dirty page write percent. More...
 
const SBDB_CacheStatisticsCBDB_Cache::GetStatistics () const
 Get cache operations statistics. More...
 
void CBDB_Cache::GetStatistics (SBDB_CacheStatistics *cache_stat) const
 Get cache operations statistics. More...
 
void CBDB_Cache::InitStatistics ()
 Drop the previously collected statistics. More...
 
void CBDB_Cache::SetSaveStatistics (bool save)
 
bool CBDB_Cache::IsSaveStatistics (void) const
 
void CBDB_Cache::Lock ()
 Lock cache access. More...
 
void CBDB_Cache::Unlock ()
 Unlock cache access. More...
 
void CBDB_Cache::DropBlob (const string &key, int version, const string &subkey, bool for_update, unsigned *blob_id, unsigned *coord)
 Delete BLOB. More...
 
const stringCBDB_Cache::GetName () const
 
unsigned CBDB_Cache::GetNextBlobId (bool lock_id)
 Get next BLOB id out from the atomic couter. More...
 
bool CBDB_Cache::IsLocked (unsigned blob_id)
 Check if BLOB is locked. More...
 
bool CBDB_Cache::IsLocked (const string &key, int version, const string &subkey)
 
void CBDB_Cache::KillBlob (const string &key, int version, const string &subkey, int overflow, unsigned blob_id)
 
void CBDB_Cache::WriteOverflow (CNcbiOfstream &overflow_file, const string &overflow_file_path, const char *buf, streamsize count)
 Write to the overflow file with error checking If write failes, method deletes the file to avoid file system space leak then throws an exception. More...
 
void CBDB_Cache::RegisterOverflow (const string &key, int version, const string &subkey, unsigned time_to_live, const string &owner)
 Register BLOB object as overflow file. More...
 
time_t CBDB_Cache::ComputeMaxTime (time_t start) const
 Compute maximum TTL. More...
 
void CBDB_Cache::x_Store (unsigned blob_id, const string &key, int version, const string &subkey, const void *data, size_t size, unsigned int time_to_live, const string &owner, bool do_blob_lock)
 
time_t CBDB_Cache::x_ComputeExpTime (int time_stamp, unsigned ttl, int timeout)
 
bool CBDB_Cache::x_CheckTimeStampExpired (SCache_AttrDB &attr_db, time_t curr, time_t *exp_time=0)
 
void CBDB_Cache::x_UpdateReadAccessTime (const string &key, int version, const string &subkey, CBDB_Transaction &trans)
 
void CBDB_Cache::x_UpdateAccessTime (const string &key, int version, const string &subkey, EBlobAccessType access_type, CBDB_Transaction &trans)
 Transactional update of access time attributes. More...
 
bool CBDB_Cache::x_RetrieveBlobAttributes (const string &key, int version, const string &subkey, int &overflow, unsigned int &ttl, unsigned int &blob_id, unsigned int &volume_id, unsigned int &split_id)
 1. More...
 
bool CBDB_Cache::x_FetchBlobAttributes (const string &key, int version, const string &subkey)
 
void CBDB_Cache::x_DropBlob (const string &key, int version, const string &subkey, int overflow, unsigned blob_id, CBDB_Transaction &trans)
 
bool CBDB_Cache::DropBlobWithExpCheck (const string &key, int version, const string &subkey, CBDB_Transaction &trans)
 Drop BLOB with time expiration check. More...
 
bool CBDB_Cache::DropBlobWithExpCheck (unsigned blob_id, CBDB_Transaction &trans)
 Drop BLOB with time expiration check. More...
 
void CBDB_Cache::x_DropOverflow (const string &key, int version, const string &subkey)
 
void CBDB_Cache::x_DropOverflow (const string &file_path)
 
void CBDB_Cache::x_TruncateDB ()
 
void CBDB_Cache::x_Close ()
 
void CBDB_Cache::x_PidLock (ELockMode lm)
 
void CBDB_Cache::x_PerformCheckPointNoLock (unsigned bytes_written)
 
IReaderCBDB_Cache::x_CreateOverflowReader (const string &key, int version, const string &subkey, size_t &file_length, TBlobLock &blob_lock)
 
void CBDB_Cache::x_UpdateOwnerStatOnDelete (const string &owner, bool expl_delete)
 update BLOB owners' statistics on BLOB delete More...
 
unsigned CBDB_Cache::GetBlobId (const string &key, int version, const string &subkey)
 Determines BLOB size (requires fetched attribute record) More...
 
void CBDB_Cache::AddToTimeLine (unsigned blob_id, time_t exp_time)
 Add BLOB to expiration timeline. More...
 
EBlobCheckinRes CBDB_Cache::BlobCheckIn (unsigned blob_id_ext, const string &key, int version, const string &subkey, EBlobCheckinMode mode, TBlobLock &blob_lock, bool do_id_lock, unsigned *volume_id, unsigned *split_id, unsigned *overflow)
 Check if BLOB exists, create registration record if necessary. More...
 
void CBDB_Cache::EvaluateTimeLine (bool *interrupted)
 Evaluate timeline BLOBs as deletion candidates. More...
 
 CBDB_Cache::CBDB_Cache (const CBDB_Cache &)
 
CBDB_CacheCBDB_Cache::operator= (const CBDB_Cache &)
 
 CBDB_Cache::CacheKey::CacheKey (const string &x_key, int x_version, const string &x_subkey)
 
bool CBDB_Cache::CacheKey::operator< (const CacheKey &cache_key) const
 
void BDB_ConfigureCache (CBDB_Cache &bdb_cache, const string &path, const string &name, unsigned timeout, ICache::TTimeStampFlags tflags)
 Utility for simple cache configuration. More...
 
void NCBI_BDB_ICacheEntryPoint (CPluginManager< ICache >::TDriverInfoList &info_list, CPluginManager< ICache >::EEntryPointRequest method)
 
void NCBI_EntryPoint_xcache_bdb (CPluginManager< ICache >::TDriverInfoList &info_list, CPluginManager< ICache >::EEntryPointRequest method)
 
 CBDB_CacheHolder::CBDB_CacheHolder (ICache *blob_cache, ICache *id_cache)
 
 CBDB_CacheHolder::~CBDB_CacheHolder ()
 
ICacheCBDB_CacheHolder::GetBlobCache ()
 
ICacheCBDB_CacheHolder::GetIdCache ()
 
 CBDB_CacheHolder::CBDB_CacheHolder (const CBDB_CacheHolder &)
 
CBDB_CacheHolderCBDB_CacheHolder::operator= (const CBDB_CacheHolder &)
 

Variables

CBDB_FieldString SCache_AttrDB::key
 
CBDB_FieldInt4 SCache_AttrDB::version
 
CBDB_FieldString SCache_AttrDB::subkey
 
CBDB_FieldUint4 SCache_AttrDB::time_stamp
 access timestamp More...
 
CBDB_FieldInt4 SCache_AttrDB::overflow
 overflow flag More...
 
CBDB_FieldUint4 SCache_AttrDB::ttl
 time-to-live More...
 
CBDB_FieldUint4 SCache_AttrDB::max_time
 max ttl limit for BLOB More...
 
CBDB_FieldUint4 SCache_AttrDB::upd_count
 update counter More...
 
CBDB_FieldUint4 SCache_AttrDB::read_count
 read counter More...
 
CBDB_FieldUint4 SCache_AttrDB::blob_id
 BLOB counter. More...
 
CBDB_FieldUint4 SCache_AttrDB::volume_id
 demux coord[0] More...
 
CBDB_FieldUint4 SCache_AttrDB::split_id
 demux coord[1] More...
 
CBDB_FieldString SCache_AttrDB::owner_name
 owner's name More...
 
CBDB_FieldUint4 SCache_IdIDX::blob_id
 
CBDB_FieldString SCache_IdIDX::key
 
CBDB_FieldInt4 SCache_IdIDX::version
 
CBDB_FieldString SCache_IdIDX::subkey
 
unsigned SBDB_TimeAccessStatistics::day
 
unsigned SBDB_TimeAccessStatistics::hour
 
unsigned SBDB_TimeAccessStatistics::put_count
 
unsigned SBDB_TimeAccessStatistics::get_count
 
unsigned SBDB_CacheUnitStatistics::blobs_stored_total
 Total number of blobs. More...
 
unsigned SBDB_CacheUnitStatistics::blobs_overflow_total
 number of overflow blobs More...
 
unsigned SBDB_CacheUnitStatistics::blobs_updates_total
 How many updates registered. More...
 
unsigned SBDB_CacheUnitStatistics::blobs_never_read_total
 BLOBs never read before. More...
 
unsigned SBDB_CacheUnitStatistics::blobs_read_total
 Number of reads. More...
 
unsigned SBDB_CacheUnitStatistics::blobs_expl_deleted_total
 BLOBs explicitly removed. More...
 
unsigned SBDB_CacheUnitStatistics::blobs_purge_deleted_total
 BLOBs garbage collected. More...
 
double SBDB_CacheUnitStatistics::blobs_size_total
 Size of BLOBs total. More...
 
unsigned SBDB_CacheUnitStatistics::blob_size_max_total
 Largest BLOB ever. More...
 
unsigned SBDB_CacheUnitStatistics::blobs_db
 Current database number of records. More...
 
double SBDB_CacheUnitStatistics::blobs_size_db
 Current size of all BLOBs. More...
 
unsigned SBDB_CacheUnitStatistics::err_protocol
 Protocol errors. More...
 
unsigned SBDB_CacheUnitStatistics::err_communication
 Communication error. More...
 
unsigned SBDB_CacheUnitStatistics::err_internal
 Internal errors of all sorts. More...
 
unsigned SBDB_CacheUnitStatistics::err_no_blob
 BLOB not found errors. More...
 
unsigned SBDB_CacheUnitStatistics::err_blob_get
 retrive errors More...
 
unsigned SBDB_CacheUnitStatistics::err_blob_put
 store errors More...
 
unsigned SBDB_CacheUnitStatistics::err_blob_over_quota
 BLOB max quota. More...
 
TBlobSizeHistogram SBDB_CacheUnitStatistics::blob_size_hist
 Blob size historgam. More...
 
TTimeAccess SBDB_CacheUnitStatistics::time_access
 Hourly access history. More...
 
SBDB_CacheUnitStatistics SBDB_CacheStatistics::m_GlobalStat
 
TOwnerStatMap SBDB_CacheStatistics::m_OwnerStatMap
 
string CBDB_Cache::CacheKey::key
 
int CBDB_Cache::CacheKey::version
 
string CBDB_Cache::CacheKey::subkey
 
string CBDB_Cache::m_Path
 Path to storage. More...
 
string CBDB_Cache::m_Name
 Cache name. More...
 
CPIDGuardCBDB_Cache::m_PidGuard
 Cache lock. More...
 
bool CBDB_Cache::m_ReadOnly
 read-only flag More...
 
bool CBDB_Cache::m_InitIfDirty
 Delete DB if it wasn't closed clean. More...
 
bool CBDB_Cache::m_JoinedEnv
 Joined environment. More...
 
TLockVector CBDB_Cache::m_LockVector
 BLOB lock vector. More...
 
unsigned CBDB_Cache::m_LockTimeout
 Lock timeout (ms) More...
 
CBDB_EnvCBDB_Cache::m_Env
 Common environment for cache DBs. More...
 
bool CBDB_Cache::m_Closed
 Double-close safeguard flag. More...
 
TSplitStoreCBDB_Cache::m_BLOB_SplitStore
 Cache BLOB storage. More...
 
SCache_AttrDBCBDB_Cache::m_CacheAttrDB
 Cache attributes database. More...
 
SCache_IdIDXCBDB_Cache::m_CacheIdIDX
 Cache id index. More...
 
CFastMutex CBDB_Cache::m_DB_Lock
 Database lock. More...
 
SCache_AttrDBCBDB_Cache::m_CacheAttrDB_RO1
 Cache attributes r-only1. More...
 
CFastMutex CBDB_Cache::m_CARO1_Lock
 Database lock. More...
 
SCache_AttrDBCBDB_Cache::m_CacheAttrDB_RO2
 Cache attributes r-only2. More...
 
CFastMutex CBDB_Cache::m_CARO2_Lock
 Database lock. More...
 
SCache_IdIDXCBDB_Cache::m_CacheIdIDX_RO
 Cache id index r-only. More...
 
CFastMutex CBDB_Cache::m_IDIDX_Lock_RO
 Database lock. More...
 
TTimeStampFlags CBDB_Cache::m_TimeStampFlag
 Time stamp flag. More...
 
unsigned CBDB_Cache::m_Timeout
 Timeout expiration policy. More...
 
unsigned CBDB_Cache::m_MaxTimeout
 Maximum time to live. More...
 
EKeepVersions CBDB_Cache::m_VersionFlag
 Version retention policy. More...
 
EWriteSyncMode CBDB_Cache::m_WSync
 Write syncronization. More...
 
unsigned CBDB_Cache::m_PurgeBatchSize
 Number of records to process in Purge() (with locking) More...
 
unsigned CBDB_Cache::m_BatchSleep
 Sleep interval (milliseconds) between batches. More...
 
CSemaphore CBDB_Cache::m_PurgeStopSignal
 TRUE when Purge processing requested to stop. More...
 
unsigned CBDB_Cache::m_CleanLogOnPurge
 Number of bytes stored in cache since last checkpoint Clean log on Purge (factor) More...
 
unsigned CBDB_Cache::m_PurgeCount
 Number of times we run purge. More...
 
unsigned CBDB_Cache::m_LogSizeMax
 transaction log size More...
 
string CBDB_Cache::m_LogDir
 Transaction log location. More...
 
CRef< CCacheCleanerThreadCBDB_Cache::m_PurgeThread
 Purge thread. More...
 
bool CBDB_Cache::m_PurgeNowRunning
 Flag that Purge is already running. More...
 
bool CBDB_Cache::m_RunPurgeThread
 Run a background purge thread. More...
 
unsigned CBDB_Cache::m_PurgeThreadDelay
 Delay in seconds between Purge runs. More...
 
unsigned CBDB_Cache::m_CheckPointInterval
 Trnasaction checkpoint interval (bytes) More...
 
unsigned CBDB_Cache::m_CheckPointDelay
 Trnasaction checkpoint interval (minutes) More...
 
unsigned CBDB_Cache::m_OverflowLimit
 Overflow limit (objects lower than that stored as BLOBs) More...
 
unsigned CBDB_Cache::m_MaxTTL_prolong
 Number of m_MaxTimeout values object lives (read-prolongation) More...
 
SBDB_CacheStatistics CBDB_Cache::m_Statistics
 Stat counters. More...
 
bool CBDB_Cache::m_SaveStatistics
 If it's necessary to store work statistics or not. More...
 
CFastLocalTime CBDB_Cache::m_LocalTimer
 Fast local timer. More...
 
CAtomicCounter CBDB_Cache::m_BlobIdCounter
 Atomic counter for BLOB ids. More...
 
unsigned CBDB_Cache::m_MaxBlobSize
 Max.allowed BLOB size. More...
 
unsigned CBDB_Cache::m_RoundRobinVolumes
 Number of rotated volumes. More...
 
unsigned CBDB_Cache::m_MempTrickle
 memp_trickle parameter (percent) More...
 
time_t CBDB_Cache::m_NextExpTime
 Time of the next blob expiration. More...
 
IServer_MonitorCBDB_Cache::m_Monitor
 Pointer to monitoring interface. More...
 
TTimeLineCBDB_Cache::m_TimeLine
 BLOB expiration timeline. More...
 
CFastMutex CBDB_Cache::m_TimeLine_Lock
 
time_t CBDB_Cache::m_LastTimeLineCheck
 
TBitVector CBDB_Cache::m_GC_Deleted
 BLOB ids deleted by GC. More...
 
shared_ptr< boolCBDB_Cache::m_StopThreadFlag
 
const char * kBDBCacheDriverName
 
ICacheCBDB_CacheHolder::m_BlobCache
 
ICacheCBDB_CacheHolder::m_IdCache
 

Friends

class CBDB_Cache::CCacheTransaction
 
class CBDB_Cache::CBDB_CacheIWriter
 
class CBDB_Cache::CBDB_CacheIReader
 
class CBDB_Cache::CBDB_Cache_OnAppExit
 

Error logging functions

void CBDB_Cache::RegisterInternalError (SBDB_CacheUnitStatistics::EErrGetPut operation, const string &owner)
 
void CBDB_Cache::RegisterProtocolError (SBDB_CacheUnitStatistics::EErrGetPut operation, const string &owner)
 
void CBDB_Cache::RegisterNoBlobError (SBDB_CacheUnitStatistics::EErrGetPut operation, const string &owner)
 
void CBDB_Cache::RegisterCommError (SBDB_CacheUnitStatistics::EErrGetPut operation, const string &owner)
 

ICache interface

virtual TFlags CBDB_Cache::GetFlags ()
 Retrieve the effective combination of flags from the underlying storage. More...
 
virtual void CBDB_Cache::SetFlags (TFlags flags)
 Pass flags to the underlying storage. More...
 
virtual void CBDB_Cache::SetTimeStampPolicy (TTimeStampFlags policy, unsigned int timeout, unsigned int max_timeout=0)
 Set timestamp update policy. More...
 
virtual TTimeStampFlags CBDB_Cache::GetTimeStampPolicy () const
 Get timestamp policy. More...
 
virtual int CBDB_Cache::GetTimeout () const
 Get expiration timeout. More...
 
virtual bool CBDB_Cache::IsOpen () const
 
virtual void CBDB_Cache::SetVersionRetention (EKeepVersions policy)
 Set version retention policy. More...
 
virtual EKeepVersions CBDB_Cache::GetVersionRetention () const
 Get version retention. More...
 
void CBDB_Cache::Store (unsigned blob_id_ext, const string &key, int version, const string &subkey, const void *data, size_t size, unsigned int time_to_live=0, const string &owner=kEmptyStr)
 
virtual void CBDB_Cache::Store (const string &key, int version, const string &subkey, const void *data, size_t size, unsigned int time_to_live=0, const string &owner=kEmptyStr)
 Add or replace BLOB. More...
 
bool CBDB_Cache::GetSizeEx (const string &key, int version, const string &subkey, size_t *size)
 
virtual size_t CBDB_Cache::GetSize (const string &key, int version, const string &subkey)
 Check if BLOB exists, return BLOB size. More...
 
virtual void CBDB_Cache::GetBlobOwner (const string &key, int version, const string &subkey, string *owner)
 Retrieve BLOB owner. More...
 
virtual bool CBDB_Cache::Read (const string &key, int version, const string &subkey, void *buf, size_t buf_size)
 Fetch the BLOB. More...
 
virtual IReaderCBDB_Cache::GetReadStream (const string &key, int version, const string &subkey)
 Return sequential stream interface to read BLOB data. More...
 
virtual IReaderCBDB_Cache::GetReadStream (const string &key, const string &subkey, int *version, EBlobVersionValidity *validity)
 Request the latest version of a BLOB. More...
 
virtual void CBDB_Cache::SetBlobVersionAsCurrent (const string &key, const string &subkey, int version)
 Set current valid version for a BLOB. More...
 
virtual void CBDB_Cache::GetBlobAccess (const string &key, int version, const string &subkey, SBlobAccessDescr *blob_descr)
 Get BLOB access using BlobAccessDescr. More...
 
IWriterCBDB_Cache::GetWriteStream (unsigned blob_id_ext, const string &key, int version, const string &subkey, bool do_id_lock, unsigned int time_to_live=0, const string &owner=kEmptyStr)
 
virtual IWriterCBDB_Cache::GetWriteStream (const string &key, int version, const string &subkey, unsigned int time_to_live=0, const string &owner=kEmptyStr)
 Return sequential stream interface to write BLOB data. More...
 
virtual void CBDB_Cache::Remove (const string &key)
 
virtual void CBDB_Cache::Remove (const string &key, int version, const string &subkey)
 Remove specific cache entry. More...
 
virtual time_t CBDB_Cache::GetAccessTime (const string &key, int version, const string &subkey)
 Return last access time for the specified cache entry. More...
 
virtual bool CBDB_Cache::HasBlobs (const string &key, const string &subkey)
 Check if any BLOB exists (any version) More...
 
virtual void CBDB_Cache::Purge (time_t access_timeout)
 Delete all BLOBs older than specified. More...
 
virtual void CBDB_Cache::Purge (const string &key, const string &subkey, time_t access_timeout)
 Delete BLOBs with access time older than specified. More...
 
virtual bool CBDB_Cache::SameCacheParams (const TCacheParams *params) const
 
virtual string CBDB_Cache::GetCacheName (void) const
 

Detailed Description

Typedef Documentation

◆ TBitVector

Definition at line 730 of file bdb_blobcache.hpp.

◆ TBlobLock

Definition at line 736 of file bdb_blobcache.hpp.

◆ TBlobSizeHistogram

Blob size to number of blobs.

Definition at line 162 of file bdb_blobcache.hpp.

◆ TLockVector

Definition at line 735 of file bdb_blobcache.hpp.

◆ TOwnerStatMap

Definition at line 279 of file bdb_blobcache.hpp.

◆ TSplitStore

Split store for BLOBs.

Definition at line 734 of file bdb_blobcache.hpp.

◆ TTimeAccess

Definition at line 163 of file bdb_blobcache.hpp.

◆ TTimeLine

Definition at line 737 of file bdb_blobcache.hpp.

Enumeration Type Documentation

◆ EBlobAccessType

access type for "UpdateAccessTime" methods

Enumerator
eBlobStore 
eBlobUpdate 
eBlobRead 

Definition at line 747 of file bdb_blobcache.hpp.

◆ EBlobCheckinMode

BLOB check-in mode.

Enumerator
eBlobCheckIn 

Check if record exists.

eBlobCheckIn_Create 

If record does not exist - create.

Definition at line 845 of file bdb_blobcache.hpp.

◆ EBlobCheckinRes

Result of BLOB check-in process.

Enumerator
EBlobCheckIn_NotFound 

BLOB does not exist.

eBlobCheckIn_Found 

Existing BLOB.

eBlobCheckIn_Created 

BLOB record created.

Definition at line 851 of file bdb_blobcache.hpp.

◆ EErrGetPut

Put/Get errors.

Enumerator
eErr_Unknown 

no info on operation

eErr_Put 

Put error.

eErr_Get 

Get error.

Definition at line 207 of file bdb_blobcache.hpp.

◆ ELockMode

Locking modes to protect cache instance.

Enumerator
eNoLock 

Do not lock-protect cache instance.

ePidLock 

Create PID lock on cache (exception if failed)

Definition at line 314 of file bdb_blobcache.hpp.

◆ ETRansact

Underlying BDB database can be configured using transactional or non-transactional API.

Transactional provides better protection from failures, non-transactional offers better performance.

Enumerator
eUseTrans 

Use transaction environment.

eNoTrans 

Non-transactional environment.

Definition at line 342 of file bdb_blobcache.hpp.

◆ EWriteSyncMode

Suggest page size.

Should be called before Open. Does not have any effect if cache is already created. Options controlling transaction and write syncronicity.

Enumerator
eWriteSync 
eWriteNoSync 

Definition at line 303 of file bdb_blobcache.hpp.

Function Documentation

◆ AddBlobQuotaError() [1/2]

void SBDB_CacheUnitStatistics::AddBlobQuotaError ( )

◆ AddBlobQuotaError() [2/2]

void SBDB_CacheStatistics::AddBlobQuotaError ( const string client)

◆ AddCommError() [1/2]

void SBDB_CacheStatistics::AddCommError ( const string client,
SBDB_CacheUnitStatistics::EErrGetPut  operation 
)

◆ AddCommError() [2/2]

void SBDB_CacheUnitStatistics::AddCommError ( EErrGetPut  operation)

◆ AddExplDelete() [1/2]

void SBDB_CacheUnitStatistics::AddExplDelete ( )
inline

◆ AddExplDelete() [2/2]

void SBDB_CacheStatistics::AddExplDelete ( const string client)

◆ AddInternalError() [1/2]

void SBDB_CacheStatistics::AddInternalError ( const string client,
SBDB_CacheUnitStatistics::EErrGetPut  operation 
)

◆ AddInternalError() [2/2]

void SBDB_CacheUnitStatistics::AddInternalError ( EErrGetPut  operation)

◆ AddNeverRead() [1/2]

void SBDB_CacheUnitStatistics::AddNeverRead ( )
inline

◆ AddNeverRead() [2/2]

void SBDB_CacheStatistics::AddNeverRead ( const string client)

◆ AddNoBlobError() [1/2]

void SBDB_CacheStatistics::AddNoBlobError ( const string client,
SBDB_CacheUnitStatistics::EErrGetPut  operation 
)

◆ AddNoBlobError() [2/2]

void SBDB_CacheUnitStatistics::AddNoBlobError ( EErrGetPut  operation)

◆ AddProtocolError() [1/2]

void SBDB_CacheStatistics::AddProtocolError ( const string client,
SBDB_CacheUnitStatistics::EErrGetPut  operation 
)

◆ AddProtocolError() [2/2]

void SBDB_CacheUnitStatistics::AddProtocolError ( EErrGetPut  operation)

◆ AddPurgeDelete() [1/2]

void SBDB_CacheUnitStatistics::AddPurgeDelete ( )
inline

◆ AddPurgeDelete() [2/2]

void SBDB_CacheStatistics::AddPurgeDelete ( const string client)

◆ AddRead() [1/2]

void SBDB_CacheStatistics::AddRead ( const string client,
time_t  tm 
)

◆ AddRead() [2/2]

void SBDB_CacheUnitStatistics::AddRead ( time_t  tm)

◆ AddStore() [1/2]

void SBDB_CacheStatistics::AddStore ( const string client,
time_t  tm,
unsigned  store,
unsigned  update,
unsigned  blob_size,
unsigned  overflow 
)

◆ AddStore() [2/2]

void SBDB_CacheUnitStatistics::AddStore ( time_t  tm,
unsigned  store,
unsigned  update,
unsigned  blob_size,
unsigned  overflow 
)

◆ AddToHistogram()

void SBDB_CacheUnitStatistics::AddToHistogram ( TBlobSizeHistogram hist,
unsigned  size 
)
static

◆ AddToTimeLine()

void CBDB_Cache::AddToTimeLine ( unsigned  blob_id,
time_t  exp_time 
)
private

Add BLOB to expiration timeline.

Definition at line 3488 of file bdb_blobcache.cpp.

References CTimeLine< BV >::AddObject(), CBDB_Cache::m_TimeLine, and CBDB_Cache::m_TimeLine_Lock.

◆ BDB_ConfigureCache()

void BDB_ConfigureCache ( CBDB_Cache bdb_cache,
const string path,
const string name,
unsigned  timeout,
ICache::TTimeStampFlags  tflags 
)

Utility for simple cache configuration.

Parameters
bdb_cacheCache instance to configure
pathPath to the cache database
nameCache database name
timeoutCache elements time to live value (in seconds) (when "0" 24hrs value is taken)
tflagsTimestamp flags (see ICache) (when 0 some reasonable default combination is taken)

Definition at line 5422 of file bdb_blobcache.cpp.

References ICache::eKeepAll, CBDB_Cache::eNoLock, CBDB_Cache::eUseTrans, ICache::fCheckExpirationAlways, ICache::fExpireLeastFrequentlyUsed, ICache::fPurgeOnStartup, ICache::fTimeStampOnCreate, CBDB_Cache::Open(), CBDB_Cache::SetTimeStampPolicy(), and CBDB_Cache::SetVersionRetention().

◆ BDB_Register_Cache()

void BDB_Register_Cache ( void  )

Register NCBI_BDB_ICacheEntryPoint.

Definition at line 5151 of file bdb_blobcache.cpp.

References NCBI_BDB_ICacheEntryPoint().

◆ BlobCheckIn()

CBDB_Cache::EBlobCheckinRes CBDB_Cache::BlobCheckIn ( unsigned  blob_id_ext,
const string key,
int  version,
const string subkey,
EBlobCheckinMode  mode,
TBlobLock blob_lock,
bool  do_id_lock,
unsigned *  volume_id,
unsigned *  split_id,
unsigned *  overflow 
)
private

◆ CacheKey()

CBDB_Cache::CacheKey::CacheKey ( const string x_key,
int  x_version,
const string x_subkey 
)

Definition at line 5130 of file bdb_blobcache.cpp.

◆ CBDB_Cache() [1/2]

CBDB_Cache::CBDB_Cache ( )

◆ CBDB_Cache() [2/2]

CBDB_Cache::CBDB_Cache ( const CBDB_Cache )
private

◆ CBDB_CacheHolder() [1/2]

CBDB_CacheHolder::CBDB_CacheHolder ( const CBDB_CacheHolder )
private

◆ CBDB_CacheHolder() [2/2]

CBDB_CacheHolder::CBDB_CacheHolder ( ICache blob_cache,
ICache id_cache 
)

Definition at line 5410 of file bdb_blobcache.cpp.

◆ CleanLog()

void CBDB_Cache::CleanLog ( )

Remove all non-active LOG files.

Definition at line 1683 of file bdb_blobcache.cpp.

References CBDB_Env::CleanLog(), CBDB_Env::IsTransactional(), and CBDB_Cache::m_Env.

Referenced by CBDB_Cache::Close().

◆ CleanLogOnPurge()

void CBDB_Cache::CleanLogOnPurge ( unsigned int  factor)
inline

When factor is non zero every factor-even Purge will remove old log files.

(For factor == 1 every Purge will try to remove logs)

Definition at line 460 of file bdb_blobcache.hpp.

References CBDB_Cache::m_CleanLogOnPurge.

◆ Close()

void CBDB_Cache::Close ( void  )

◆ ComputeMaxTime()

time_t CBDB_Cache::ComputeMaxTime ( time_t  start) const
inlineprotected

Compute maximum TTL.

Definition at line 712 of file bdb_blobcache.hpp.

References CBDB_Cache::GetTimeout(), and CBDB_Cache::GetTTL_Prolongation().

Referenced by CBDB_Cache::RegisterOverflow(), and CBDB_Cache::x_Store().

◆ ConvertToRegistry() [1/2]

void SBDB_CacheStatistics::ConvertToRegistry ( IRWRegistry reg) const

◆ ConvertToRegistry() [2/2]

void SBDB_CacheUnitStatistics::ConvertToRegistry ( IRWRegistry reg,
const string sect_name_postfix 
) const

◆ DropBlob()

void CBDB_Cache::DropBlob ( const string key,
int  version,
const string subkey,
bool  for_update,
unsigned *  blob_id,
unsigned *  coord 
)

◆ DropBlobWithExpCheck() [1/2]

bool CBDB_Cache::DropBlobWithExpCheck ( const string key,
int  version,
const string subkey,
CBDB_Transaction trans 
)
private

◆ DropBlobWithExpCheck() [2/2]

bool CBDB_Cache::DropBlobWithExpCheck ( unsigned  blob_id,
CBDB_Transaction trans 
)
private

◆ EvaluateTimeLine()

void CBDB_Cache::EvaluateTimeLine ( bool interrupted)
private

Evaluate timeline BLOBs as deletion candidates.

Parameters
interruptedreturns TRUE if stop signal received during the call

Definition at line 3524 of file bdb_blobcache.cpp.

References _ASSERT, CTimeLine< BV >::AddObject(), bm::bvector< Alloc >::any(), CTime::AsString(), SCache_AttrDB::blob_id, SCache_IdIDX::blob_id, SCacheDescr::blob_id, CBDB_Transaction::Commit(), bm::bvector< Alloc >::count(), NStr::DoubleToString(), CBDB_Cache::DropBlobWithExpCheck(), eBDB_Ok, CBDB_FileCursor::eEQ, CBDB_FileCursor::eGE, CStopWatch::Elapsed(), CBDB_Transaction::eNoAssociation, CStopWatch::eStart, CBDB_Transaction::eTransASync, CTimeLine< BV >::ExtractObjects(), CBDB_FileCursor::Fetch(), bm::bvector< Alloc >::first(), CBDB_FileCursor::From, CTimeLine< BV >::GetDiscrFactor(), GetFastLocalTime(), i, IServer_Monitor::IsActive(), ncbi::grid::netcache::search::fields::key, SCache_IdIDX::key, SCacheDescr::key, CBDB_Cache::m_BatchSleep, CBDB_Cache::m_CacheAttrDB_RO2, CBDB_Cache::m_CacheIdIDX_RO, CBDB_Cache::m_CARO2_Lock, CBDB_Cache::m_Env, CBDB_Cache::m_GC_Deleted, CBDB_Cache::m_IDIDX_Lock_RO, CBDB_Cache::m_LastTimeLineCheck, CBDB_Cache::m_Monitor, CBDB_Cache::m_PurgeBatchSize, CBDB_Cache::m_PurgeStopSignal, CBDB_Cache::m_TimeLine, CBDB_Cache::m_TimeLine_Lock, bm::bvector< Alloc >::optimize(), SCache_AttrDB::overflow, SCacheDescr::overflow, IServer_Monitor::Send(), CBDB_FileCursor::SetCondition(), CBDB_RawFile::SetTransaction(), ncbi::grid::netcache::search::fields::subkey, SCache_IdIDX::subkey, SCacheDescr::subkey, sw, CSemaphore::TryWait(), NStr::UIntToString(), NStr::ULongToString(), bm::bvector< Alloc >::iterator_base::valid(), SCache_IdIDX::version, SCacheDescr::version, version, and CBDB_Cache::x_CheckTimeStampExpired().

Referenced by CBDB_Cache::Purge().

◆ GetAccessTime()

time_t CBDB_Cache::GetAccessTime ( const string key,
int  version,
const string subkey 
)
virtual

Return last access time for the specified cache entry.

Class implementation may want to implement access time based aging scheme for cache managed objects. In this case it needs to track time of every request to BLOB data.

Parameters
keyBLOB identification key
subkeyBLOB identification subkey
versionBLOB version
Returns
last access time
See also
TimeStampUpdatePolicy

Implements ICache.

Definition at line 3417 of file bdb_blobcache.cpp.

References _ASSERT, eBDB_Ok, CBDB_File::Fetch(), ncbi::grid::netcache::search::fields::key, SCache_AttrDB::key, CBDB_Cache::m_CacheAttrDB, CBDB_Cache::m_DB_Lock, CBDB_RawFile::SetTransaction(), ncbi::grid::netcache::search::fields::subkey, SCache_AttrDB::subkey, SCache_AttrDB::time_stamp, SCache_AttrDB::version, and version.

◆ GetBatchSleep()

unsigned CBDB_Cache::GetBatchSleep ( ) const

Definition at line 3456 of file bdb_blobcache.cpp.

References CBDB_Cache::m_BatchSleep, and CBDB_Cache::m_DB_Lock.

◆ GetBlobAccess()

void CBDB_Cache::GetBlobAccess ( const string key,
int  version,
const string subkey,
SBlobAccessDescr blob_descr 
)
virtual

Get BLOB access using BlobAccessDescr.

Method fills blob_descr parameter. If provided buffer has sufficient capacity for BLOB storage, BLOB is saved into the buffer, otherwise IReader is created.

Note
Method supposed to provide fast access to relatively small BLOBs

Implements ICache.

Definition at line 2890 of file bdb_blobcache.cpp.

References _ASSERT, SBDB_CacheStatistics::AddRead(), ICache::SBlobAccessDescr::blob_found, ICache::SBlobAccessDescr::blob_size, ICache::SBlobAccessDescr::buf, ICache::SBlobAccessDescr::buf_size, buffer, CBDB_Cache::CBDB_CacheIReader, CBDB_Transaction::Commit(), eBDB_Ok, CBDB_FileCursor::eEQ, CBDB_Transaction::eNoAssociation, CBDB_FileCursor::eReadModifyUpdate, CBDB_RawFile::eReallocForbidden, CBDB_Transaction::eTransASync, ICache::fCheckExpirationAlways, CBDB_FileCursor::Fetch(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::Fetch(), CBDB_FileCursor::From, ICache::fTimeStampOnRead, CBDB_Cache::GetBlobId(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::GetCoordinates(), CFastLocalTime::GetLocalTimezone(), CBDB_Cache::IsSaveStatistics(), ncbi::grid::netcache::search::fields::key, CBDB_Cache::m_BLOB_SplitStore, CBDB_Cache::m_CacheAttrDB, CBDB_Cache::m_DB_Lock, CBDB_Cache::m_Env, CBDB_Cache::m_LocalTimer, CBDB_Cache::m_LockTimeout, CBDB_Cache::m_LockVector, CBDB_Cache::m_Statistics, CBDB_Cache::m_TimeStampFlag, SCache_AttrDB::max_time, SCache_AttrDB::overflow, SCache_AttrDB::owner_name, SCache_AttrDB::read_count, ICache::SBlobAccessDescr::reader, CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::ReadRealloc(), CBDB_FileCursor::SetCondition(), CBDB_RawFile::SetTransaction(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::SetTransaction(), SCache_AttrDB::split_id, ncbi::grid::netcache::search::fields::subkey, SCache_AttrDB::time_stamp, CBDB_FieldString::ToString(), CBDB_FileCursor::Update(), version, SCache_AttrDB::volume_id, CBDB_Cache::x_CheckTimeStampExpired(), and CBDB_Cache::x_CreateOverflowReader().

◆ GetBlobCache()

ICache* CBDB_CacheHolder::GetBlobCache ( )
inline

Definition at line 1057 of file bdb_blobcache.hpp.

References CBDB_CacheHolder::m_BlobCache.

◆ GetBlobId()

unsigned CBDB_Cache::GetBlobId ( const string key,
int  version,
const string subkey 
)
private

◆ GetBlobOwner()

void CBDB_Cache::GetBlobOwner ( const string key,
int  version,
const string subkey,
string owner 
)
virtual

◆ GetCacheName()

virtual string CBDB_Cache::GetCacheName ( void  ) const
inlinevirtual

Implements ICache.

Definition at line 653 of file bdb_blobcache.hpp.

References CBDB_Cache::m_Name, and CBDB_Cache::m_Path.

◆ GetEnv()

CBDB_Env* CBDB_Cache::GetEnv ( void  )
inline

Get environment.

Definition at line 391 of file bdb_blobcache.hpp.

References CBDB_Cache::m_Env.

◆ GetFlags()

ICache::TFlags CBDB_Cache::GetFlags ( )
virtual

Retrieve the effective combination of flags from the underlying storage.

Implements ICache.

Definition at line 1699 of file bdb_blobcache.cpp.

◆ GetIdCache()

ICache* CBDB_CacheHolder::GetIdCache ( )
inline

Definition at line 1058 of file bdb_blobcache.hpp.

References CBDB_CacheHolder::m_IdCache.

◆ GetMaxBlobSize()

unsigned CBDB_Cache::GetMaxBlobSize ( ) const
inline

Get max allowed BLOB size.

Definition at line 484 of file bdb_blobcache.hpp.

References CBDB_Cache::m_MaxBlobSize.

Referenced by CBDB_CacheIWriter::Write(), and CBDB_Cache::x_Store().

◆ GetMonitor()

IServer_Monitor* CBDB_Cache::GetMonitor ( )
inline

Get monitor.

Definition at line 409 of file bdb_blobcache.hpp.

References CBDB_Cache::m_Monitor.

◆ GetName()

const string& CBDB_Cache::GetName ( void  ) const
inline

◆ GetNextBlobId()

unsigned CBDB_Cache::GetNextBlobId ( bool  lock_id)

Get next BLOB id out from the atomic couter.

Parameters
lock_idWhen true new id is immediately gets locked

Definition at line 4639 of file bdb_blobcache.cpp.

References CAtomicCounter::Add(), BDB_THROW, bm::bvector< Alloc >::clear(), kMax_UInt, CBDB_Cache::m_BlobIdCounter, CBDB_Cache::m_GC_Deleted, CBDB_Cache::m_LockVector, CAtomicCounter::Set(), and CLockVector< BV >::TryLock().

Referenced by CBDB_Cache::BlobCheckIn(), and CBDB_Cache::RegisterOverflow().

◆ GetOverflowLimit()

unsigned CBDB_Cache::GetOverflowLimit ( ) const
inline

Definition at line 470 of file bdb_blobcache.hpp.

References CBDB_Cache::m_OverflowLimit.

Referenced by CBDB_CacheIWriter::Write(), and CBDB_Cache::x_Store().

◆ GetPurgeBatchSize()

unsigned CBDB_Cache::GetPurgeBatchSize ( ) const

Definition at line 3444 of file bdb_blobcache.cpp.

References CBDB_Cache::m_DB_Lock, and CBDB_Cache::m_PurgeBatchSize.

Referenced by CBDB_Cache::Purge().

◆ GetReadStream() [1/2]

IReader * CBDB_Cache::GetReadStream ( const string key,
const string subkey,
int version,
EBlobVersionValidity validity 
)
virtual

Request the latest version of a BLOB.

Parameters
[in]keyBLOB identification key
[in]subkeyBLOB identification subkey
[out]versionVersion of the returned BLOB
[out]validityValidity of the version of the returned BLOB
Returns
Sequential stream interface to read BLOB data. Return NULL if the BLOB data is not found in the cache.
Note
If the BLOB data is not found in the cache, then neither 'version' nor 'validity' values will be set by the method.
See also
SetCurrentBlobVersion()

Implements ICache.

Definition at line 2871 of file bdb_blobcache.cpp.

References NCBI_USER_THROW.

◆ GetReadStream() [2/2]

IReader * CBDB_Cache::GetReadStream ( const string key,
int  version,
const string subkey 
)
virtual

Return sequential stream interface to read BLOB data.

Parameters
keyBLOB identification key
subkeyBLOB identification subkey
versionBLOB version
Returns
Interface pointer or NULL if BLOB does not exist

Implements ICache.

Definition at line 2671 of file bdb_blobcache.cpp.

References _ASSERT, SBDB_CacheStatistics::AddRead(), SCache_AttrDB::blob_id, buffer, CBDB_Cache::CBDB_CacheIReader, CBDB_Transaction::Commit(), eBDB_Ok, CBDB_FileCursor::eEQ, CBDB_Transaction::eNoAssociation, CBDB_FileCursor::eReadModifyUpdate, CBDB_Transaction::eTransASync, ICache::fCheckExpirationAlways, CBDB_FileCursor::Fetch(), CBDB_FileCursor::From, ICache::fTimeStampOnRead, CBDB_Cache::GetBlobId(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::GetCoordinates(), CFastLocalTime::GetLocalTimezone(), CBDB_Cache::IsSaveStatistics(), ncbi::grid::netcache::search::fields::key, CBDB_Cache::m_BLOB_SplitStore, CBDB_Cache::m_CacheAttrDB, CBDB_Cache::m_DB_Lock, CBDB_Cache::m_Env, CBDB_Cache::m_LocalTimer, CBDB_Cache::m_LockTimeout, CBDB_Cache::m_LockVector, CBDB_Cache::m_Statistics, CBDB_Cache::m_TimeStampFlag, SCache_AttrDB::max_time, SCache_AttrDB::overflow, SCache_AttrDB::owner_name, SCache_AttrDB::read_count, CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::ReadRealloc(), CBDB_FileCursor::SetCondition(), CBDB_RawFile::SetTransaction(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::SetTransaction(), SCache_AttrDB::split_id, ncbi::grid::netcache::search::fields::subkey, SCache_AttrDB::time_stamp, CBDB_FieldString::ToString(), CBDB_FileCursor::Update(), version, SCache_AttrDB::volume_id, CBDB_Cache::x_CheckTimeStampExpired(), and CBDB_Cache::x_CreateOverflowReader().

◆ GetSize()

size_t CBDB_Cache::GetSize ( const string key,
int  version,
const string subkey 
)
virtual

Check if BLOB exists, return BLOB size.

Parameters
keyBLOB identification key
subkeyBLOB identification subkey
versionBLOB version
Returns
BLOB size or 0 if it doesn't exist or expired

Implements ICache.

Definition at line 2341 of file bdb_blobcache.cpp.

References CBDB_Cache::GetSizeEx(), ncbi::grid::netcache::search::fields::key, ncbi::grid::netcache::search::fields::size, ncbi::grid::netcache::search::fields::subkey, and version.

◆ GetSizeEx()

bool CBDB_Cache::GetSizeEx ( const string key,
int  version,
const string subkey,
size_t *  size 
)

◆ GetStatistics() [1/2]

const SBDB_CacheStatistics& CBDB_Cache::GetStatistics ( ) const
inline

Get cache operations statistics.

Definition at line 496 of file bdb_blobcache.hpp.

References CBDB_Cache::m_Statistics.

◆ GetStatistics() [2/2]

void CBDB_Cache::GetStatistics ( SBDB_CacheStatistics cache_stat) const

Get cache operations statistics.

Thread safe (syncronized) operation

Definition at line 1749 of file bdb_blobcache.cpp.

References _ASSERT, CBDB_Cache::m_DB_Lock, and CBDB_Cache::m_Statistics.

◆ GetTimeout()

int CBDB_Cache::GetTimeout ( ) const
virtual

Get expiration timeout.

Returns
Expiration timeout in seconds
See also
SetTimeStampPolicy

Implements ICache.

Definition at line 1733 of file bdb_blobcache.cpp.

References CBDB_Cache::m_Timeout.

Referenced by CBDB_Cache::ComputeMaxTime(), CBDB_Cache::Open(), CBDB_Cache::Purge(), CBDB_Cache::x_CheckTimeStampExpired(), and CBDB_Cache::x_Store().

◆ GetTimeStampPolicy()

CBDB_Cache::TTimeStampFlags CBDB_Cache::GetTimeStampPolicy ( ) const
virtual

Get timestamp policy.

Returns
Timestamp policy

Implements ICache.

Definition at line 1728 of file bdb_blobcache.cpp.

References CBDB_Cache::m_TimeStampFlag.

◆ GetTTL_Prolongation()

unsigned CBDB_Cache::GetTTL_Prolongation ( ) const
inline

Get max limit for read update.

Definition at line 478 of file bdb_blobcache.hpp.

References CBDB_Cache::m_MaxTTL_prolong.

Referenced by CBDB_Cache::ComputeMaxTime().

◆ GetVersionRetention()

CBDB_Cache::EKeepVersions CBDB_Cache::GetVersionRetention ( ) const
virtual

Get version retention.

Implements ICache.

Definition at line 1744 of file bdb_blobcache.cpp.

References CBDB_Cache::m_VersionFlag.

◆ GetWriteStream() [1/2]

IWriter * CBDB_Cache::GetWriteStream ( const string key,
int  version,
const string subkey,
unsigned int  time_to_live = 0,
const string owner = kEmptyStr 
)
virtual

Return sequential stream interface to write BLOB data.

Parameters
keyBLOB identification key
subkeyBLOB identification subkey
versionBLOB version
time_to_liveIndividual timeout
Returns
Interface pointer or NULL if BLOB does not exist

Implements ICache.

Definition at line 3196 of file bdb_blobcache.cpp.

References CBDB_Cache::GetWriteStream(), ncbi::grid::netcache::search::fields::key, ncbi::grid::netcache::search::fields::subkey, and version.

◆ GetWriteStream() [2/2]

IWriter * CBDB_Cache::GetWriteStream ( unsigned  blob_id_ext,
const string key,
int  version,
const string subkey,
bool  do_id_lock,
unsigned int  time_to_live = 0,
const string owner = kEmptyStr 
)

◆ GetWriteSync()

EWriteSyncMode CBDB_Cache::GetWriteSync ( ) const
inline

Definition at line 311 of file bdb_blobcache.hpp.

References CBDB_Cache::m_WSync.

Referenced by CBDB_Cache::Open().

◆ GlobalStatistics()

SBDB_CacheUnitStatistics& SBDB_CacheStatistics::GlobalStatistics ( )
inline

Definition at line 276 of file bdb_blobcache.hpp.

References SBDB_CacheStatistics::m_GlobalStat.

Referenced by CBDB_Cache::Purge().

◆ HasBlobs()

bool CBDB_Cache::HasBlobs ( const string key,
const string subkey 
)
virtual

◆ Init() [1/2]

void SBDB_CacheUnitStatistics::Init ( void  )

◆ Init() [2/2]

void SBDB_CacheStatistics::Init ( void  )

◆ InitHistorgam()

void SBDB_CacheUnitStatistics::InitHistorgam ( TBlobSizeHistogram hist)
private

Definition at line 633 of file bdb_blobcache.cpp.

References _ASSERT, map_checker< Container >::clear(), i, and kMax_UInt.

Referenced by SBDB_CacheUnitStatistics::Init().

◆ InitStatistics()

void CBDB_Cache::InitStatistics ( )

Drop the previously collected statistics.

Definition at line 1757 of file bdb_blobcache.cpp.

References SBDB_CacheStatistics::Init(), CBDB_Cache::m_DB_Lock, and CBDB_Cache::m_Statistics.

◆ IsJoinedEnv()

bool CBDB_Cache::IsJoinedEnv ( )
inline

Return true if environment is not created but joined.

Definition at line 394 of file bdb_blobcache.hpp.

References CBDB_Cache::m_JoinedEnv.

◆ IsLocked() [1/2]

bool CBDB_Cache::IsLocked ( const string key,
int  version,
const string subkey 
)

◆ IsLocked() [2/2]

bool CBDB_Cache::IsLocked ( unsigned  blob_id)

Check if BLOB is locked.

Definition at line 4858 of file bdb_blobcache.cpp.

References CLockVector< BV >::IsLocked(), and CBDB_Cache::m_LockVector.

Referenced by CBDB_Cache::IsLocked().

◆ IsOpen()

virtual bool CBDB_Cache::IsOpen ( ) const
inlinevirtual
Returns
TRUE if cache is open and operational

Implements ICache.

Definition at line 555 of file bdb_blobcache.hpp.

References CBDB_Cache::m_BLOB_SplitStore.

Referenced by CBDB_Cache::SetOverflowLimit().

◆ IsReadOnly()

bool CBDB_Cache::IsReadOnly ( ) const
inline

◆ IsSaveStatistics()

bool CBDB_Cache::IsSaveStatistics ( void  ) const
inline

◆ KillBlob()

void CBDB_Cache::KillBlob ( const string key,
int  version,
const string subkey,
int  overflow,
unsigned  blob_id 
)
protected

◆ Lock()

void CBDB_Cache::Lock ( void  )

Lock cache access.

Definition at line 5071 of file bdb_blobcache.cpp.

References CFastMutex::Lock(), and CBDB_Cache::m_DB_Lock.

◆ NCBI_BDB_ICacheEntryPoint()

void NCBI_BDB_ICacheEntryPoint ( CPluginManager< ICache >::TDriverInfoList &  info_list,
CPluginManager< ICache >::EEntryPointRequest  method 
)

◆ NCBI_EntryPoint_xcache_bdb()

void NCBI_EntryPoint_xcache_bdb ( CPluginManager< ICache >::TDriverInfoList &  info_list,
CPluginManager< ICache >::EEntryPointRequest  method 
)

Definition at line 5402 of file bdb_blobcache.cpp.

References NCBI_BDB_ICacheEntryPoint().

◆ Open()

void CBDB_Cache::Open ( const string cache_path,
const string cache_name,
ELockMode  lm = eNoLock,
Uint8  cache_ram_size = 0,
ETRansact  use_trans = eUseTrans,
unsigned int  log_mem_size = 0 
)

Open local cache instance (read-write access) If cache does not exists it is created.

Parameters
cache_pathPath to cache
cache_nameCache instance name
lmLocking mode, protection against using the cache from multiple applications
cache_ram_sizeBerkeley DB memory cache settings
log_mem_sizeSize of in memory transaction log
See also
OpenReadOnly

Definition at line 1233 of file bdb_blobcache.cpp.

References _ASSERT, CDirEntry::AddTrailingPathSeparator(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::AssignCoordinates(), BDB_RecoverEnv(), SCache_AttrDB::blob_id, SCache_IdIDX::blob_id, CBDB_Cache::Close(), CDir::Create(), eBDB_Ok, CBDB_FileCursor::eFirst, CDir::eIgnoreRecursive, CBDB_Cache::eNoTrans, CBDB_RawFile::eReadOnly, CBDB_RawFile::eReadWriteCreate, ERR_POST, ERR_POST_X, CBDB_Env::eRunRecovery, CBDB_Env::eThreaded, CBDB_Transaction::eTransASync, CBDB_Transaction::eTransSync, CBDB_Cache::eUseTrans, CBDB_Cache::eWriteSync, CFile::Exists(), CDir::Exists(), CBDB_File::Fetch(), CBDB_FileCursor::Fetch(), ICache::fPurgeOnStartup, CDir::GetEntries(), CDirEntry::GetPath(), CCurrentProcess::GetPid(), CBDB_FieldString::GetString(), CBDB_Cache::GetTimeout(), CBDB_Cache::GetWriteSync(), Info(), CBDB_FileCursor::InitMultiFetch(), set< Key, Compare >::insert(), CBDB_File::Insert(), int, CBDB_ErrnoException::IsRecovery(), CBDB_Env::IsTransactional(), CBDB_Env::JoinEnv(), kBDBCacheStartedFileName, ncbi::grid::netcache::search::fields::key, SCache_AttrDB::key, SCache_IdIDX::key, LOG_POST_X, CBDB_Cache::m_BatchSleep, CBDB_Cache::m_BLOB_SplitStore, CBDB_Cache::m_BlobIdCounter, CBDB_Cache::m_CacheAttrDB, CBDB_Cache::m_CacheAttrDB_RO1, CBDB_Cache::m_CacheAttrDB_RO2, CBDB_Cache::m_CacheIdIDX, CBDB_Cache::m_CacheIdIDX_RO, CBDB_Cache::m_CheckPointInterval, CBDB_Cache::m_Closed, CBDB_Cache::m_DB_Lock, CBDB_Cache::m_Env, CBDB_Cache::m_InitIfDirty, CBDB_Cache::m_JoinedEnv, CBDB_Cache::m_LastTimeLineCheck, CBDB_Cache::m_LogDir, CBDB_Cache::m_LogSizeMax, CBDB_Cache::m_Name, CBDB_Cache::m_NextExpTime, CBDB_Cache::m_Path, CBDB_Cache::m_PurgeBatchSize, CBDB_Cache::m_PurgeThreadDelay, CBDB_Cache::m_ReadOnly, CBDB_Cache::m_RoundRobinVolumes, CBDB_Cache::m_RunPurgeThread, CBDB_Cache::m_TimeLine, CBDB_Cache::m_Timeout, CBDB_Cache::m_TimeStampFlag, CDirEntry::MakePath(), max(), NStr::NumericToString(), CBDB_File::Open(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::Open(), CBDB_Env::OpenErrFile(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::OpenProjections(), CBDB_Env::OpenWithLocks(), CBDB_Env::OpenWithTrans(), CBDB_Cache::Purge(), CDirEntry::Remove(), CDir::Remove(), CAtomicCounter::Set(), CBDB_Env::SetCacheSize(), CBDB_Env::SetCheckPointKB(), CBDB_FileCursor::SetCondition(), CBDB_RawFile::SetEnv(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::SetEnv(), CBDB_Env::SetLockTimeout(), CBDB_Env::SetLogAutoRemove(), CBDB_Env::SetLogBSize(), CBDB_Env::SetLogDir(), CBDB_Env::SetLogFileMax(), CBDB_Env::SetLogInMemory(), CBDB_Env::SetMaxLocks(), CBDB_RawFile::SetTransaction(), CBDB_Env::SetTransactionSync(), CBDB_Env::SetTransactionTimeout(), SCache_AttrDB::split_id, CBDB_Cache::StartPurgeThread(), string, ncbi::grid::netcache::search::fields::subkey, SCache_AttrDB::subkey, SCache_IdIDX::subkey, SCache_AttrDB::version, SCache_IdIDX::version, version, SCache_AttrDB::volume_id, Warning(), CFileWriter::Write(), and CBDB_Cache::x_PidLock().

Referenced by BDB_ConfigureCache(), and CSplitCacheApp::SetupCache().

◆ OpenReadOnly()

void CBDB_Cache::OpenReadOnly ( const string cache_path,
const string cache_name,
unsigned int  cache_ram_size = 0 
)

Open local cache in read-only mode.

This is truely passive mode of operations. All modification calls are ignored, no statistics is going to be collected, no timestamps. PID locking is also not available.

See also
Open

Definition at line 1590 of file bdb_blobcache.cpp.

References CDirEntry::AddTrailingPathSeparator(), CBDB_Cache::Close(), CBDB_RawFile::eReadOnly, Info(), LOG_POST_X, CBDB_Cache::m_BLOB_SplitStore, CBDB_Cache::m_CacheAttrDB, CBDB_Cache::m_DB_Lock, CBDB_Cache::m_Name, CBDB_Cache::m_Path, CBDB_Cache::m_ReadOnly, CBDB_File::Open(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::Open(), and string.

◆ operator<()

bool CBDB_Cache::CacheKey::operator< ( const CacheKey cache_key) const

◆ operator=() [1/2]

CBDB_Cache& CBDB_Cache::operator= ( const CBDB_Cache )
private

◆ operator=() [2/2]

CBDB_CacheHolder& CBDB_CacheHolder::operator= ( const CBDB_CacheHolder )
private

◆ PrintStatistics() [1/2]

void SBDB_CacheUnitStatistics::PrintStatistics ( CNcbiOstream out) const

◆ PrintStatistics() [2/2]

void SBDB_CacheStatistics::PrintStatistics ( CNcbiOstream out) const

◆ Purge() [1/2]

void CBDB_Cache::Purge ( const string key,
const string subkey,
time_t  access_timeout 
)
virtual

◆ Purge() [2/2]

void CBDB_Cache::Purge ( time_t  access_timeout)
virtual

Delete all BLOBs older than specified.

Parameters
access_timeoutTime in seconds. All objects older than this are deleted.

Implements ICache.

Definition at line 3865 of file bdb_blobcache.cpp.

References SBDB_CacheStatistics::AddNeverRead(), CTimeLine< BV >::AddObject(), SBDB_CacheStatistics::AddPurgeDelete(), CTime::AsString(), SCache_AttrDB::blob_id, SBDB_CacheUnitStatistics::blobs_db, CBDB_Env::CleanLog(), CBDB_Transaction::Commit(), bm::bvector< Alloc >::count(), CBDB_RawFile::CountRecs(), delta(), CBDB_Cache::DropBlobWithExpCheck(), eBDB_Ok, CBDB_FileCursor::eGE, CBDB_Transaction::eNoAssociation, CTimeLine< BV >::EnumerateObjects(), ERR_POST_X, Error(), CBDB_Transaction::eTransASync, CBDB_Cache::EvaluateTimeLine(), fabs, CBDB_FileCursor::Fetch(), CBDB_Env::ForceTransactionCheckpoint(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::FreeUnusedMem(), CLockVector< BV >::FreeUnusedMem(), CBDB_FileCursor::From, CTimeLine< BV >::GetDiscrFactor(), GetFastLocalTime(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::GetIdVector(), CBDB_Cache::GetPurgeBatchSize(), SBDB_CacheStatistics::GlobalStatistics(), i, Info(), IServer_Monitor::IsActive(), CBDB_Cache::IsReadOnly(), CBDB_ErrnoException::IsRecovery(), CBDB_Cache::IsSaveStatistics(), ncbi::grid::netcache::search::fields::key, SCache_AttrDB::key, SCacheDescr::key, LOG_POST_X, CBDB_Cache::m_BatchSleep, CBDB_Cache::m_BLOB_SplitStore, CBDB_Cache::m_CacheAttrDB_RO2, CBDB_Cache::m_CARO2_Lock, CBDB_Cache::m_CleanLogOnPurge, CBDB_Cache::m_DB_Lock, CBDB_Cache::m_Env, CBDB_Cache::m_LockVector, CBDB_Cache::m_Monitor, CBDB_Cache::m_NextExpTime, CBDB_Cache::m_PurgeCount, CBDB_Cache::m_PurgeNowRunning, CBDB_Cache::m_PurgeStopSignal, CBDB_Cache::m_PurgeThreadDelay, CBDB_Cache::m_Statistics, CBDB_Cache::m_TimeLine, CBDB_Cache::m_TimeLine_Lock, SCache_AttrDB::overflow, SCache_AttrDB::owner_name, precision, SCache_AttrDB::read_count, CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::Save(), IServer_Monitor::Send(), CBDB_FileCursor::SetCondition(), CPurgeFlagGuard::SetFlag(), CBDB_RawFile::SetTransaction(), NStr::SizetToString(), ncbi::grid::netcache::search::fields::subkey, SCache_AttrDB::subkey, SCacheDescr::subkey, CBDB_FieldString::ToString(), CSemaphore::TryWait(), NStr::UIntToString(), SCache_AttrDB::version, SCacheDescr::version, version, Warning(), CBDB_Cache::x_CheckTimeStampExpired(), CBDB_Cache::x_TruncateDB(), and CBDB_Cache::x_UpdateOwnerStatOnDelete().

Referenced by CBDB_Cache::GetWriteStream(), CBDB_Cache::Open(), CSplitCacheApp::SetupCache(), and CBDB_Cache::x_Store().

◆ Read()

bool CBDB_Cache::Read ( const string key,
int  version,
const string subkey,
void *  buf,
size_t  buf_size 
)
virtual

Fetch the BLOB.

Parameters
keyBLOB identification key
subkeyBLOB identification subkey
versionBLOB version
bufpointer on destination buffer
sizebuffer size in bytes (chars)
Returns
FALSE if BLOB doesn't exist or expired
Note
Throws an exception if provided memory buffer is insufficient to read the BLOB

Implements ICache.

Definition at line 2429 of file bdb_blobcache.cpp.

References _ASSERT, SBDB_CacheStatistics::AddRead(), SCache_AttrDB::blob_id, buf, CBDB_Transaction::Commit(), eBDB_Ok, CBDB_FileCursor::eEQ, CBDB_Transaction::eNoAssociation, CBDB_FileCursor::eReadModifyUpdate, CBDB_RawFile::eReallocForbidden, CBDB_Transaction::eTransASync, ICache::fCheckExpirationAlways, CBDB_FileCursor::Fetch(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::Fetch(), CBDB_FileCursor::From, ICache::fTimeStampOnRead, CBDB_Cache::GetBlobId(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::GetCoordinates(), CFastLocalTime::GetLocalTimezone(), CBDB_Cache::GetName(), in(), CBDB_Cache::IsSaveStatistics(), ncbi::grid::netcache::search::fields::key, CBDB_Cache::m_BLOB_SplitStore, CBDB_Cache::m_CacheAttrDB, CBDB_Cache::m_DB_Lock, CBDB_Cache::m_Env, CBDB_Cache::m_LocalTimer, CBDB_Cache::m_LockTimeout, CBDB_Cache::m_LockVector, CBDB_Cache::m_Path, CBDB_Cache::m_Statistics, CBDB_Cache::m_TimeStampFlag, SCache_AttrDB::max_time, SCache_AttrDB::overflow, SCache_AttrDB::owner_name, SCache_AttrDB::read_count, s_MakeOverflowFileName(), CBDB_FileCursor::SetCondition(), CBDB_RawFile::SetTransaction(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::SetTransaction(), SCache_AttrDB::split_id, ncbi::grid::netcache::search::fields::subkey, SCache_AttrDB::time_stamp, CBDB_FieldString::ToString(), CBDB_FileCursor::Update(), version, SCache_AttrDB::volume_id, and CBDB_Cache::x_CheckTimeStampExpired().

◆ RegisterCommError()

void CBDB_Cache::RegisterCommError ( SBDB_CacheUnitStatistics::EErrGetPut  operation,
const string owner 
)

◆ RegisterInternalError()

void CBDB_Cache::RegisterInternalError ( SBDB_CacheUnitStatistics::EErrGetPut  operation,
const string owner 
)

◆ RegisterNoBlobError()

void CBDB_Cache::RegisterNoBlobError ( SBDB_CacheUnitStatistics::EErrGetPut  operation,
const string owner 
)

◆ RegisterOverflow()

void CBDB_Cache::RegisterOverflow ( const string key,
int  version,
const string subkey,
unsigned  time_to_live,
const string owner 
)
protected

◆ RegisterProtocolError()

void CBDB_Cache::RegisterProtocolError ( SBDB_CacheUnitStatistics::EErrGetPut  operation,
const string owner 
)

◆ Remove() [1/2]

void CBDB_Cache::Remove ( const string key)
virtual

◆ Remove() [2/2]

void CBDB_Cache::Remove ( const string key,
int  version,
const string subkey 
)
virtual

◆ RunPurgeThread()

void CBDB_Cache::RunPurgeThread ( unsigned  purge_delay = 30)

Schedule a background Purge thread (cleans the cache from the obsolete entries) SetPurgeBatchSize and SetBatchSleep should be used to regulate the thread priority.

Parameters
purge_delaySleep delay in seconds between consequtive Purge Runs
Note
Actual thread is started by Open() (works only in MT builds)
See also
SetPurgeBatchSize, SetBatchSleep

Definition at line 1538 of file bdb_blobcache.cpp.

References CBDB_Cache::m_PurgeThreadDelay, and CBDB_Cache::m_RunPurgeThread.

◆ SameCacheParams()

bool CBDB_Cache::SameCacheParams ( const TCacheParams params) const
virtual

◆ SBDB_CacheStatistics()

SBDB_CacheStatistics::SBDB_CacheStatistics ( )

Definition at line 984 of file bdb_blobcache.cpp.

◆ SBDB_CacheUnitStatistics()

SBDB_CacheUnitStatistics::SBDB_CacheUnitStatistics ( )

Definition at line 612 of file bdb_blobcache.cpp.

References SBDB_CacheUnitStatistics::Init().

◆ SBDB_TimeAccessStatistics()

SBDB_TimeAccessStatistics::SBDB_TimeAccessStatistics ( unsigned  d,
unsigned  hr,
unsigned  put,
unsigned  get 
)
inline

Definition at line 150 of file bdb_blobcache.hpp.

◆ SCache_AttrDB()

SCache_AttrDB::SCache_AttrDB ( )
inline

◆ SCache_IdIDX()

SCache_IdIDX::SCache_IdIDX ( )
inline

◆ SetBatchSleep()

void CBDB_Cache::SetBatchSleep ( unsigned  sleep)

Set sleep in milliseconds between Purge batches (for low priority Purge processes)

Definition at line 3450 of file bdb_blobcache.cpp.

References CBDB_Cache::m_BatchSleep, and CBDB_Cache::m_DB_Lock.

◆ SetBlobVersionAsCurrent()

void CBDB_Cache::SetBlobVersionAsCurrent ( const string key,
const string subkey,
int  version 
)
virtual

Set current valid version for a BLOB.

Parameters
[in]keyBLOB identification key
[in]subkeyBLOB identification subkey
[in]versionBLOB version which must be considered valid from now on
Note
Throw exception in case of transient errors.
There is an important special case: if the underlying storage is inherently incapable of storing BLOB version info without storing the BLOB itself, and there is currently no blob with the specified key/subkey/version present in the cache, then this function will just do nothing, and it will not throw exception.
See also
GetReadStream()

Implements ICache.

Definition at line 2881 of file bdb_blobcache.cpp.

References NCBI_USER_THROW.

◆ SetCheckpoint()

void CBDB_Cache::SetCheckpoint ( unsigned int  bytes)
inline

Checkpoint the database at least as often as every bytes of log file are written.

Definition at line 464 of file bdb_blobcache.hpp.

References CBDB_Cache::m_CheckPointInterval.

◆ SetCheckpointDelay()

void CBDB_Cache::SetCheckpointDelay ( unsigned int  delay)
inline

Checkpoint the database every 'delay' minutes.

Definition at line 467 of file bdb_blobcache.hpp.

References CBDB_Cache::m_CheckPointDelay.

◆ SetFlags()

void CBDB_Cache::SetFlags ( TFlags  flags)
virtual

Pass flags to the underlying storage.

Implements ICache.

Definition at line 1704 of file bdb_blobcache.cpp.

◆ SetInitIfDirty()

void CBDB_Cache::SetInitIfDirty ( bool  value)
inline

Definition at line 437 of file bdb_blobcache.hpp.

References CBDB_Cache::m_InitIfDirty, and rapidjson::value.

◆ SetLogDir()

void CBDB_Cache::SetLogDir ( const string log_dir)
inline

Transaction log directory.

Definition at line 432 of file bdb_blobcache.hpp.

References CBDB_Cache::m_LogDir.

◆ SetLogFileMax()

void CBDB_Cache::SetLogFileMax ( unsigned  fl_size)
inline

Set transaction log file size.

Definition at line 426 of file bdb_blobcache.hpp.

References CBDB_Cache::m_LogSizeMax.

◆ SetMaxBlobSize()

void CBDB_Cache::SetMaxBlobSize ( unsigned  max_size)
inline

Set max allowed BLOB size.

Definition at line 481 of file bdb_blobcache.hpp.

References CBDB_Cache::m_MaxBlobSize.

◆ SetMempTrickle()

void CBDB_Cache::SetMempTrickle ( unsigned  memp_trickle)
inline

Set dirty page write percent.

Definition at line 490 of file bdb_blobcache.hpp.

References CBDB_Cache::m_MempTrickle.

◆ SetMonitor()

void CBDB_Cache::SetMonitor ( IServer_Monitor monitor)
inline

Set monitor (class does NOT take ownership)

Monitor should be set at right after construction, before using cache. (Especially important in MT environment)

Definition at line 406 of file bdb_blobcache.hpp.

References CBDB_Cache::m_Monitor.

◆ SetOverflowLimit()

void CBDB_Cache::SetOverflowLimit ( unsigned  limit)

Definition at line 1197 of file bdb_blobcache.cpp.

References _ASSERT, CBDB_Cache::IsOpen(), and CBDB_Cache::m_OverflowLimit.

◆ SetPurgeBatchSize()

void CBDB_Cache::SetPurgeBatchSize ( unsigned  batch_size)

Number of records in scanned at once by Purge Cache is exclusively locks an internal mutex while scanning the batch and all other threads is getting locked.

Definition at line 3438 of file bdb_blobcache.cpp.

References CBDB_Cache::m_DB_Lock, and CBDB_Cache::m_PurgeBatchSize.

◆ SetReadUpdateLimit()

void CBDB_Cache::SetReadUpdateLimit ( unsigned  )
inline

Set update attribute limit (0 by default)

When cache is configured to update BLOB time stamps on read it can cause delays because it needs to initiate a transaction every time you read. This method configures a delayed update. Cache keeps all updates until it reaches the limit and saves it all in one transaction.

Definition at line 419 of file bdb_blobcache.hpp.

Referenced by CSplitCacheApp::SetupCache().

◆ SetRR_Volumes()

void CBDB_Cache::SetRR_Volumes ( unsigned  rrv)
inline

Set number of rotated round-robin volumes.

Definition at line 487 of file bdb_blobcache.hpp.

References CBDB_Cache::m_RoundRobinVolumes.

◆ SetSaveStatistics()

void CBDB_Cache::SetSaveStatistics ( bool  save)
inline

Definition at line 508 of file bdb_blobcache.hpp.

References CBDB_Cache::m_SaveStatistics.

◆ SetTimeStampPolicy()

void CBDB_Cache::SetTimeStampPolicy ( TTimeStampFlags  policy,
unsigned int  timeout,
unsigned int  max_timeout = 0 
)
virtual

Set timestamp update policy.

Parameters
policyA bitwise combination of "ETimeStampFlags".
timeoutDefault expiration timeout for the stored BLOBs.
max_timeoutMaximum value for individually set BLOB timeouts. If "max_timeout" < "timeout", then it 'll be set to "timeout".

Implements ICache.

Definition at line 1708 of file bdb_blobcache.cpp.

References CBDB_Cache::m_DB_Lock, CBDB_Cache::m_MaxTimeout, CBDB_Cache::m_MaxTTL_prolong, CBDB_Cache::m_Timeout, and CBDB_Cache::m_TimeStampFlag.

Referenced by BDB_ConfigureCache(), and CSplitCacheApp::SetupCache().

◆ SetTTL_Prolongation()

void CBDB_Cache::SetTTL_Prolongation ( unsigned  ttl_prolong)

Maximum limit for read updates (blob expires eventually even if it is accessed) 0 - unlimited prolongation (default)

Definition at line 1173 of file bdb_blobcache.cpp.

References CBDB_Cache::m_MaxTTL_prolong.

◆ SetVersionRetention()

void CBDB_Cache::SetVersionRetention ( EKeepVersions  policy)
virtual

Set version retention policy.

Parameters
policyVersion retention mode

Implements ICache.

Definition at line 1738 of file bdb_blobcache.cpp.

References CBDB_Cache::m_DB_Lock, and CBDB_Cache::m_VersionFlag.

Referenced by BDB_ConfigureCache(), and CSplitCacheApp::SetupCache().

◆ SetWriteSync()

void CBDB_Cache::SetWriteSync ( EWriteSyncMode  wsync)
inline

Set write syncronization.

Definition at line 310 of file bdb_blobcache.hpp.

References CBDB_Cache::m_WSync.

Referenced by CSplitCacheApp::SetupCache().

◆ StartPurgeThread()

void CBDB_Cache::StartPurgeThread ( )

◆ StopPurge()

void CBDB_Cache::StopPurge ( )

Request to stop Purge.

Use this method when Purge runs in it's own thread and you need the stop that thread in the middle of processing

Definition at line 3462 of file bdb_blobcache.cpp.

References CBDB_Cache::m_DB_Lock, CBDB_Cache::m_PurgeStopSignal, and CSemaphore::Post().

Referenced by CBDB_Cache::StopPurgeThread().

◆ StopPurgeThread()

void CBDB_Cache::StopPurgeThread ( )

◆ Store() [1/2]

void CBDB_Cache::Store ( const string key,
int  version,
const string subkey,
const void *  data,
size_t  size,
unsigned int  time_to_live = 0,
const string owner = kEmptyStr 
)
virtual

Add or replace BLOB.

Parameters
keyBLOB identification key
keyBLOB identification sub-key
versionBLOB version
datapointer on data buffer
sizedata buffer size in bytes (chars)
time_to_liveIndividual timeout. Cannot exceed max timeout.

Implements ICache.

Definition at line 2267 of file bdb_blobcache.cpp.

References data, ncbi::grid::netcache::search::fields::key, ncbi::grid::netcache::search::fields::size, ncbi::grid::netcache::search::fields::subkey, version, and CBDB_Cache::x_Store().

◆ Store() [2/2]

void CBDB_Cache::Store ( unsigned  blob_id_ext,
const string key,
int  version,
const string subkey,
const void *  data,
size_t  size,
unsigned int  time_to_live = 0,
const string owner = kEmptyStr 
)

◆ Unlock()

void CBDB_Cache::Unlock ( void  )

Unlock cache access.

Definition at line 5076 of file bdb_blobcache.cpp.

References CBDB_Cache::m_DB_Lock, and CFastMutex::Unlock().

◆ Verify()

void CBDB_Cache::Verify ( const string cache_path,
const string cache_name,
const string err_file = 0,
bool  force_remove = false 
)

Run verification of the cache database.

Parameters
cache_pathPath to cache
cache_nameCache instance name
err_fileName of the error file When NULL errors are dumped to stderr

Definition at line 4348 of file bdb_blobcache.cpp.

References CDirEntry::AddTrailingPathSeparator(), CBDB_Cache::Close(), ERR_POST_X, CBDB_Env::ForceRemove(), CBDB_Cache::m_CacheAttrDB, CBDB_Cache::m_Env, CBDB_Cache::m_Path, CBDB_Env::Open(), CBDB_Env::OpenErrFile(), CBDB_Env::Remove(), CBDB_Env::SetCacheSize(), CBDB_RawFile::SetEnv(), string, and CBDB_File::Verify().

Referenced by CBDB_CacheVerifyApp::Run().

◆ WriteOverflow()

void CBDB_Cache::WriteOverflow ( CNcbiOfstream overflow_file,
const string overflow_file_path,
const char *  buf,
streamsize  count 
)
protected

Write to the overflow file with error checking If write failes, method deletes the file to avoid file system space leak then throws an exception.

Definition at line 3469 of file bdb_blobcache.cpp.

References BDB_THROW, buf, and CBDB_Cache::x_DropOverflow().

Referenced by CBDB_Cache::x_Store(), and CBDB_CacheIWriter::x_WriteOverflow().

◆ x_AddErrGetPut()

void SBDB_CacheUnitStatistics::x_AddErrGetPut ( EErrGetPut  operation)
private

◆ x_CheckTimeStampExpired()

bool CBDB_Cache::x_CheckTimeStampExpired ( SCache_AttrDB attr_db,
time_t  curr,
time_t *  exp_time = 0 
)
private

◆ x_Close()

void CBDB_Cache::x_Close ( void  )
private

◆ x_ComputeExpTime()

time_t CBDB_Cache::x_ComputeExpTime ( int  time_stamp,
unsigned  ttl,
int  timeout 
)
private

Definition at line 4408 of file bdb_blobcache.cpp.

References int, CBDB_Cache::m_MaxTimeout, and max().

Referenced by CBDB_Cache::x_Store().

◆ x_CreateOverflowReader()

IReader * CBDB_Cache::x_CreateOverflowReader ( const string key,
int  version,
const string subkey,
size_t &  file_length,
TBlobLock blob_lock 
)
private

◆ x_DropBlob()

void CBDB_Cache::x_DropBlob ( const string key,
int  version,
const string subkey,
int  overflow,
unsigned  blob_id,
CBDB_Transaction trans 
)
private

◆ x_DropOverflow() [1/2]

void CBDB_Cache::x_DropOverflow ( const string file_path)
private

Definition at line 4626 of file bdb_blobcache.cpp.

References ERR_POST_X, CDirEntry::Exists(), and CDirEntry::Remove().

◆ x_DropOverflow() [2/2]

void CBDB_Cache::x_DropOverflow ( const string key,
int  version,
const string subkey 
)
private

◆ x_FetchBlobAttributes()

bool CBDB_Cache::x_FetchBlobAttributes ( const string key,
int  version,
const string subkey 
)
private

◆ x_PerformCheckPointNoLock()

void CBDB_Cache::x_PerformCheckPointNoLock ( unsigned  bytes_written)
private

◆ x_PidLock()

void CBDB_Cache::x_PidLock ( ELockMode  lm)
private

◆ x_RetrieveBlobAttributes()

bool CBDB_Cache::x_RetrieveBlobAttributes ( const string key,
int  version,
const string subkey,
int overflow,
unsigned int ttl,
unsigned int blob_id,
unsigned int volume_id,
unsigned int split_id 
)
private

1.

Retrive overflow attributes for the BLOB (using subkey) 2. If required retrive empty subkey attribute record (for timestamp check)

Returns
TRUE if the attribute record found

Definition at line 4565 of file bdb_blobcache.cpp.

References SCache_AttrDB::blob_id, ncbi::grid::netcache::search::fields::key, CBDB_Cache::m_CacheAttrDB, SCache_AttrDB::overflow, SCache_AttrDB::split_id, ncbi::grid::netcache::search::fields::subkey, SCache_AttrDB::ttl, version, SCache_AttrDB::volume_id, and CBDB_Cache::x_FetchBlobAttributes().

Referenced by CBDB_Cache::GetSizeEx().

◆ x_Store()

void CBDB_Cache::x_Store ( unsigned  blob_id,
const string key,
int  version,
const string subkey,
const void *  data,
size_t  size,
unsigned int  time_to_live,
const string owner,
bool  do_blob_lock 
)
protected

Definition at line 1985 of file bdb_blobcache.cpp.

References _ASSERT, SBDB_CacheStatistics::AddBlobQuotaError(), CTimeLine< BV >::AddObject(), SBDB_CacheStatistics::AddStore(), BDB_THROW, SCache_AttrDB::blob_id, CBDB_Cache::BlobCheckIn(), CBDB_Transaction::Commit(), CBDB_Cache::ComputeMaxTime(), data, CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::Delete(), eBDB_Ok, CBDB_Cache::eBlobCheckIn_Create, CBDB_Cache::eBlobCheckIn_Found, CBDB_Cache::EBlobCheckIn_NotFound, ICache::eDropAll, ICache::eDropOlder, CBDB_Transaction::eEnvDefault, CBDB_FileCursor::eEQ, CBDB_Transaction::eNoAssociation, CBDB_FileCursor::eReadModifyUpdate, ERR_POST_X, Error(), CBDB_RawFile::eThrowOnError, CBDB_FileCursor::Fetch(), CBDB_FileCursor::From, CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::GetCoordinates(), CLockVectorGuard< TLockVect >::GetId(), CFastLocalTime::GetLocalTimezone(), CBDB_Cache::GetMaxBlobSize(), CBDB_Cache::GetName(), CBDB_Cache::GetOverflowLimit(), CBDB_Cache::GetTimeout(), IServer_Monitor::IsActive(), CBDB_Cache::IsReadOnly(), CBDB_Cache::IsSaveStatistics(), ncbi::grid::netcache::search::fields::key, CBDB_Cache::KillBlob(), CBDB_Cache::m_BLOB_SplitStore, CBDB_Cache::m_CacheAttrDB, CBDB_Cache::m_DB_Lock, CBDB_Cache::m_Env, CBDB_Cache::m_LocalTimer, CBDB_Cache::m_LockTimeout, CBDB_Cache::m_LockVector, CBDB_Cache::m_MaxTimeout, CBDB_Cache::m_MaxTTL_prolong, CBDB_Cache::m_Monitor, CBDB_Cache::m_Path, CBDB_Cache::m_Statistics, CBDB_Cache::m_TimeLine, CBDB_Cache::m_TimeLine_Lock, CBDB_Cache::m_Timeout, CBDB_Cache::m_VersionFlag, SCache_AttrDB::max_time, min(), out(), SCache_AttrDB::overflow, SCache_AttrDB::owner_name, CBDB_Cache::Purge(), s_MakeOverflowFileName(), IServer_Monitor::Send(), CBDB_FileCursor::SetCondition(), CBDB_RawFile::SetTransaction(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::SetTransaction(), ncbi::grid::netcache::search::fields::size, NStr::SizetToString(), SCache_AttrDB::split_id, ncbi::grid::netcache::search::fields::subkey, SCache_AttrDB::time_stamp, trunc, SCache_AttrDB::ttl, NStr::UIntToString(), SCache_AttrDB::upd_count, CBDB_FileCursor::Update(), CBDB_BlobSplitStore< TBV, TObjDeMux, TL >::UpdateInsert(), version, SCache_AttrDB::volume_id, CBDB_Cache::WriteOverflow(), CBDB_Cache::x_ComputeExpTime(), and CBDB_Cache::x_DropOverflow().

Referenced by CBDB_CacheIWriter::Flush(), CBDB_Cache::Store(), and CBDB_CacheIWriter::~CBDB_CacheIWriter().

◆ x_TruncateDB()

void CBDB_Cache::x_TruncateDB ( )
private

◆ x_UpdateAccessTime()

void CBDB_Cache::x_UpdateAccessTime ( const string key,
int  version,
const string subkey,
EBlobAccessType  access_type,
CBDB_Transaction trans 
)
private

◆ x_UpdateOwnerStatOnDelete()

void CBDB_Cache::x_UpdateOwnerStatOnDelete ( const string owner,
bool  expl_delete 
)
private

update BLOB owners' statistics on BLOB delete

Definition at line 4998 of file bdb_blobcache.cpp.

Referenced by CBDB_Cache::DropBlob(), CBDB_Cache::Purge(), and CBDB_Cache::Remove().

◆ x_UpdateReadAccessTime()

void CBDB_Cache::x_UpdateReadAccessTime ( const string key,
int  version,
const string subkey,
CBDB_Transaction trans 
)
inlineprivate

◆ ~CBDB_Cache()

CBDB_Cache::~CBDB_Cache ( )
virtual

Definition at line 1160 of file bdb_blobcache.cpp.

References CBDB_Cache::Close(), ERR_POST, and CException::what().

◆ ~CBDB_CacheHolder()

CBDB_CacheHolder::~CBDB_CacheHolder ( )

Variable Documentation

◆ blob_id [1/2]

CBDB_FieldUint4 SCache_AttrDB::blob_id

◆ blob_id [2/2]

CBDB_FieldUint4 SCache_IdIDX::blob_id

◆ blob_size_hist

TBlobSizeHistogram SBDB_CacheUnitStatistics::blob_size_hist

◆ blob_size_max_total

unsigned SBDB_CacheUnitStatistics::blob_size_max_total

◆ blobs_db

unsigned SBDB_CacheUnitStatistics::blobs_db

◆ blobs_expl_deleted_total

unsigned SBDB_CacheUnitStatistics::blobs_expl_deleted_total

◆ blobs_never_read_total

unsigned SBDB_CacheUnitStatistics::blobs_never_read_total

◆ blobs_overflow_total

unsigned SBDB_CacheUnitStatistics::blobs_overflow_total

◆ blobs_purge_deleted_total

unsigned SBDB_CacheUnitStatistics::blobs_purge_deleted_total

◆ blobs_read_total

unsigned SBDB_CacheUnitStatistics::blobs_read_total

◆ blobs_size_db

double SBDB_CacheUnitStatistics::blobs_size_db

◆ blobs_size_total

double SBDB_CacheUnitStatistics::blobs_size_total

◆ blobs_stored_total

unsigned SBDB_CacheUnitStatistics::blobs_stored_total

◆ blobs_updates_total

unsigned SBDB_CacheUnitStatistics::blobs_updates_total

◆ day

unsigned SBDB_TimeAccessStatistics::day

◆ err_blob_get

unsigned SBDB_CacheUnitStatistics::err_blob_get

◆ err_blob_over_quota

unsigned SBDB_CacheUnitStatistics::err_blob_over_quota

◆ err_blob_put

unsigned SBDB_CacheUnitStatistics::err_blob_put

◆ err_communication

unsigned SBDB_CacheUnitStatistics::err_communication

◆ err_internal

unsigned SBDB_CacheUnitStatistics::err_internal

◆ err_no_blob

unsigned SBDB_CacheUnitStatistics::err_no_blob

◆ err_protocol

unsigned SBDB_CacheUnitStatistics::err_protocol

◆ get_count

unsigned SBDB_TimeAccessStatistics::get_count

◆ hour

unsigned SBDB_TimeAccessStatistics::hour

◆ kBDBCacheDriverName

const char* kBDBCacheDriverName
extern

Definition at line 5157 of file bdb_blobcache.cpp.

Referenced by CBDB_Cache::SameCacheParams().

◆ key [1/3]

CBDB_FieldString SCache_AttrDB::key

◆ key [2/3]

CBDB_FieldString SCache_IdIDX::key

◆ key [3/3]

string CBDB_Cache::CacheKey::key

Definition at line 889 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::CacheKey::operator<().

◆ m_BatchSleep

unsigned CBDB_Cache::m_BatchSleep
private

Sleep interval (milliseconds) between batches.

Definition at line 936 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::EvaluateTimeLine(), CBDB_Cache::GetBatchSleep(), CBDB_Cache::Open(), CBDB_Cache::Purge(), and CBDB_Cache::SetBatchSleep().

◆ m_BLOB_SplitStore

TSplitStore* CBDB_Cache::m_BLOB_SplitStore
private

◆ m_BlobCache

ICache* CBDB_CacheHolder::m_BlobCache
private

◆ m_BlobIdCounter

CAtomicCounter CBDB_Cache::m_BlobIdCounter
private

Atomic counter for BLOB ids.

Definition at line 974 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::GetNextBlobId(), and CBDB_Cache::Open().

◆ m_CacheAttrDB

SCache_AttrDB* CBDB_Cache::m_CacheAttrDB
private

◆ m_CacheAttrDB_RO1

SCache_AttrDB* CBDB_Cache::m_CacheAttrDB_RO1
private

Cache attributes r-only1.

Definition at line 919 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Close(), CBDB_Cache::GetBlobId(), and CBDB_Cache::Open().

◆ m_CacheAttrDB_RO2

SCache_AttrDB* CBDB_Cache::m_CacheAttrDB_RO2
private

◆ m_CacheIdIDX

SCache_IdIDX* CBDB_Cache::m_CacheIdIDX
private

◆ m_CacheIdIDX_RO

SCache_IdIDX* CBDB_Cache::m_CacheIdIDX_RO
private

◆ m_CARO1_Lock

CFastMutex CBDB_Cache::m_CARO1_Lock
mutableprivate

Database lock.

Definition at line 920 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::GetBlobId().

◆ m_CARO2_Lock

CFastMutex CBDB_Cache::m_CARO2_Lock
mutableprivate

Database lock.

Definition at line 922 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::DropBlobWithExpCheck(), CBDB_Cache::EvaluateTimeLine(), and CBDB_Cache::Purge().

◆ m_CheckPointDelay

unsigned CBDB_Cache::m_CheckPointDelay
private

Trnasaction checkpoint interval (minutes)

Definition at line 961 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::SetCheckpointDelay(), and CBDB_Cache::StartPurgeThread().

◆ m_CheckPointInterval

unsigned CBDB_Cache::m_CheckPointInterval
private

Trnasaction checkpoint interval (bytes)

Definition at line 959 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Open(), and CBDB_Cache::SetCheckpoint().

◆ m_CleanLogOnPurge

unsigned CBDB_Cache::m_CleanLogOnPurge
private

Number of bytes stored in cache since last checkpoint Clean log on Purge (factor)

Definition at line 942 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::CleanLogOnPurge(), and CBDB_Cache::Purge().

◆ m_Closed

bool CBDB_Cache::m_Closed
private

Double-close safeguard flag.

Definition at line 913 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Close(), and CBDB_Cache::Open().

◆ m_DB_Lock

CFastMutex CBDB_Cache::m_DB_Lock
mutableprivate

◆ m_Env

CBDB_Env* CBDB_Cache::m_Env
private

◆ m_GC_Deleted

TBitVector CBDB_Cache::m_GC_Deleted
private

BLOB ids deleted by GC.

Definition at line 995 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::DropBlobWithExpCheck(), CBDB_Cache::EvaluateTimeLine(), and CBDB_Cache::GetNextBlobId().

◆ m_GlobalStat

SBDB_CacheUnitStatistics SBDB_CacheStatistics::m_GlobalStat
private

◆ m_IdCache

ICache* CBDB_CacheHolder::m_IdCache
private

◆ m_IDIDX_Lock_RO

CFastMutex CBDB_Cache::m_IDIDX_Lock_RO
mutableprivate

Database lock.

Definition at line 924 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::DropBlobWithExpCheck(), and CBDB_Cache::EvaluateTimeLine().

◆ m_InitIfDirty

bool CBDB_Cache::m_InitIfDirty
private

Delete DB if it wasn't closed clean.

Definition at line 908 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Open(), and CBDB_Cache::SetInitIfDirty().

◆ m_JoinedEnv

bool CBDB_Cache::m_JoinedEnv
private

Joined environment.

Definition at line 909 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Close(), CBDB_Cache::IsJoinedEnv(), CBDB_Cache::Open(), and CBDB_Cache::StartPurgeThread().

◆ m_LastTimeLineCheck

time_t CBDB_Cache::m_LastTimeLineCheck
private

Definition at line 993 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::EvaluateTimeLine(), and CBDB_Cache::Open().

◆ m_LocalTimer

CFastLocalTime CBDB_Cache::m_LocalTimer
private

◆ m_LockTimeout

unsigned CBDB_Cache::m_LockTimeout
private

◆ m_LockVector

TLockVector CBDB_Cache::m_LockVector
private

◆ m_LogDir

string CBDB_Cache::m_LogDir
private

Transaction log location.

Definition at line 948 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Open(), and CBDB_Cache::SetLogDir().

◆ m_LogSizeMax

unsigned CBDB_Cache::m_LogSizeMax
private

transaction log size

Definition at line 946 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Open(), and CBDB_Cache::SetLogFileMax().

◆ m_MaxBlobSize

unsigned CBDB_Cache::m_MaxBlobSize
private

Max.allowed BLOB size.

Definition at line 977 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::GetMaxBlobSize(), and CBDB_Cache::SetMaxBlobSize().

◆ m_MaxTimeout

unsigned CBDB_Cache::m_MaxTimeout
private

◆ m_MaxTTL_prolong

unsigned CBDB_Cache::m_MaxTTL_prolong
private

Number of m_MaxTimeout values object lives (read-prolongation)

Definition at line 965 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::GetTTL_Prolongation(), CBDB_Cache::GetWriteStream(), CBDB_Cache::SetTimeStampPolicy(), CBDB_Cache::SetTTL_Prolongation(), and CBDB_Cache::x_Store().

◆ m_MempTrickle

unsigned CBDB_Cache::m_MempTrickle
private

memp_trickle parameter (percent)

Definition at line 982 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::SetMempTrickle(), and CBDB_Cache::StartPurgeThread().

◆ m_Monitor

IServer_Monitor* CBDB_Cache::m_Monitor
private

Pointer to monitoring interface.

Definition at line 988 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::EvaluateTimeLine(), CBDB_Cache::GetMonitor(), CBDB_Cache::Purge(), CBDB_Cache::SetMonitor(), and CBDB_Cache::x_Store().

◆ m_Name

string CBDB_Cache::m_Name
private

◆ m_NextExpTime

time_t CBDB_Cache::m_NextExpTime
private

Time of the next blob expiration.

Definition at line 985 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Open(), and CBDB_Cache::Purge().

◆ m_OverflowLimit

unsigned CBDB_Cache::m_OverflowLimit
private

Overflow limit (objects lower than that stored as BLOBs)

Definition at line 963 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::GetOverflowLimit(), and CBDB_Cache::SetOverflowLimit().

◆ m_OwnerStatMap

TOwnerStatMap SBDB_CacheStatistics::m_OwnerStatMap
private

◆ m_Path

string CBDB_Cache::m_Path
private

◆ m_PidGuard

CPIDGuard* CBDB_Cache::m_PidGuard
private

Cache lock.

Definition at line 905 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Close(), CBDB_Cache::x_Close(), and CBDB_Cache::x_PidLock().

◆ m_PurgeBatchSize

unsigned CBDB_Cache::m_PurgeBatchSize
private

Number of records to process in Purge() (with locking)

Definition at line 934 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::EvaluateTimeLine(), CBDB_Cache::GetPurgeBatchSize(), CBDB_Cache::Open(), and CBDB_Cache::SetPurgeBatchSize().

◆ m_PurgeCount

unsigned CBDB_Cache::m_PurgeCount
private

Number of times we run purge.

Definition at line 944 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Purge().

◆ m_PurgeNowRunning

bool CBDB_Cache::m_PurgeNowRunning
private

Flag that Purge is already running.

Definition at line 953 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Purge().

◆ m_PurgeStopSignal

CSemaphore CBDB_Cache::m_PurgeStopSignal
private

TRUE when Purge processing requested to stop.

Definition at line 939 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::EvaluateTimeLine(), CBDB_Cache::Purge(), and CBDB_Cache::StopPurge().

◆ m_PurgeThread

CRef<CCacheCleanerThread> CBDB_Cache::m_PurgeThread
private

Purge thread.

Definition at line 950 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::StartPurgeThread(), and CBDB_Cache::StopPurgeThread().

◆ m_PurgeThreadDelay

unsigned CBDB_Cache::m_PurgeThreadDelay
private

Delay in seconds between Purge runs.

Definition at line 957 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Open(), CBDB_Cache::Purge(), CBDB_Cache::RunPurgeThread(), and CBDB_Cache::StartPurgeThread().

◆ m_ReadOnly

bool CBDB_Cache::m_ReadOnly
private

read-only flag

Definition at line 906 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::IsReadOnly(), CBDB_Cache::Open(), and CBDB_Cache::OpenReadOnly().

◆ m_RoundRobinVolumes

unsigned CBDB_Cache::m_RoundRobinVolumes
private

Number of rotated volumes.

Definition at line 980 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::Open(), and CBDB_Cache::SetRR_Volumes().

◆ m_RunPurgeThread

bool CBDB_Cache::m_RunPurgeThread
private

◆ m_SaveStatistics

bool CBDB_Cache::m_SaveStatistics
private

If it's necessary to store work statistics or not.

Definition at line 970 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::IsSaveStatistics(), and CBDB_Cache::SetSaveStatistics().

◆ m_Statistics

SBDB_CacheStatistics CBDB_Cache::m_Statistics
private

◆ m_StopThreadFlag

shared_ptr<bool> CBDB_Cache::m_StopThreadFlag
private

Definition at line 998 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::StartPurgeThread(), and CBDB_Cache::StopPurgeThread().

◆ m_TimeLine

TTimeLine* CBDB_Cache::m_TimeLine
private

◆ m_TimeLine_Lock

CFastMutex CBDB_Cache::m_TimeLine_Lock
mutableprivate

◆ m_Timeout

unsigned CBDB_Cache::m_Timeout
private

◆ m_TimeStampFlag

TTimeStampFlags CBDB_Cache::m_TimeStampFlag
private

◆ m_VersionFlag

EKeepVersions CBDB_Cache::m_VersionFlag
private

◆ m_WSync

EWriteSyncMode CBDB_Cache::m_WSync
private

Write syncronization.

Definition at line 932 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::GetWriteSync(), and CBDB_Cache::SetWriteSync().

◆ max_time

CBDB_FieldUint4 SCache_AttrDB::max_time

◆ overflow

CBDB_FieldInt4 SCache_AttrDB::overflow

◆ owner_name

CBDB_FieldString SCache_AttrDB::owner_name

◆ put_count

unsigned SBDB_TimeAccessStatistics::put_count

◆ read_count

CBDB_FieldUint4 SCache_AttrDB::read_count

◆ split_id

CBDB_FieldUint4 SCache_AttrDB::split_id

◆ subkey [1/3]

CBDB_FieldString SCache_AttrDB::subkey

◆ subkey [2/3]

CBDB_FieldString SCache_IdIDX::subkey

◆ subkey [3/3]

string CBDB_Cache::CacheKey::subkey

Definition at line 891 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::CacheKey::operator<().

◆ time_access

TTimeAccess SBDB_CacheUnitStatistics::time_access

◆ time_stamp

CBDB_FieldUint4 SCache_AttrDB::time_stamp

◆ ttl

CBDB_FieldUint4 SCache_AttrDB::ttl

◆ upd_count

CBDB_FieldUint4 SCache_AttrDB::upd_count

◆ version [1/3]

CBDB_FieldInt4 SCache_AttrDB::version

◆ version [2/3]

CBDB_FieldInt4 SCache_IdIDX::version

◆ version [3/3]

int CBDB_Cache::CacheKey::version

Definition at line 890 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::CacheKey::operator<().

◆ volume_id

CBDB_FieldUint4 SCache_AttrDB::volume_id

Friends

◆ CBDB_Cache_OnAppExit

friend class CBDB_Cache_OnAppExit
friend

Definition at line 999 of file bdb_blobcache.hpp.

◆ CBDB_CacheIReader

friend class CBDB_CacheIReader
friend

◆ CBDB_CacheIWriter

friend class CBDB_CacheIWriter
friend

Definition at line 899 of file bdb_blobcache.hpp.

Referenced by CBDB_Cache::GetWriteStream().

◆ CCacheTransaction

friend class CCacheTransaction
friend

Definition at line 898 of file bdb_blobcache.hpp.

Modified on Sun Apr 14 05:25:52 2024 by modify_doxy.py rev. 669887