writer = cache->GetWriteStream(m.key, m.version, m.subkey, m.time_to_live, m.owner);
119m_ThreadPool(thread_pool)
140 if(TCacheWriteAsync::GetDefault()) {
153m_GracePeriod(
max(grace_period, 0.0))
176 return m_Main->GetFlags();
188 return m_Main->SetTimeStampPolicy(policy, timeout, max_timeout);
194 return m_Main->GetTimeStampPolicy();
200 return m_Main->GetTimeout();
212 return m_Main->SetVersionRetention(policy);
218 return m_Main->GetVersionRetention();
226 size_tbytes_written;
229writer->Write(
data,
size, &bytes_written);
230 data=
static_cast<const char*
>(
data) + bytes_written;
231 size-= bytes_written;
310 return m_Main->Purge(access_timeout);
322 return m_Main->SameCacheParams(params);
328 return m_Main->GetCacheName();
NCBI_PARAM_DECL(bool, ncbi, cache_async_write)
NCBI_PARAM_DEF(bool, ncbi, cache_async_write, true)
typedef NCBI_PARAM_TYPE(ncbi, cache_async_write) TCacheWriteAsync
CThreadPool * s_CreateThreadPool()
shared_ptr< CThreadPool > m_ThreadPool
void SetTimeStampPolicy(TTimeStampFlags policy, unsigned int timeout, unsigned int max_timeout) override
Set timestamp update policy.
void SetBlobVersionAsCurrent(const string &key, const string &subkey, TBlobVersion version) override
Set current valid version for a BLOB.
CAsyncWriteCache(ICache *main, ICache *writer, double grace_period=0.0)
Constructor.
void Remove(const string &key, TBlobVersion version, const string &subkey) override
Remove specific cache entry.
void GetBlobAccess(const string &key, TBlobVersion version, const string &subkey, SBlobAccessDescr *blob_descr) override
Get BLOB access using BlobAccessDescr.
void SetVersionRetention(EKeepVersions policy) override
Set version retention policy.
bool IsOpen() const override
bool Read(const string &key, TBlobVersion version, const string &subkey, void *buf, size_t buf_size) override
Fetch the BLOB.
void GetBlobOwner(const string &key, TBlobVersion version, const string &subkey, string *owner) override
Retrieve BLOB owner.
~CAsyncWriteCache() override
bool HasBlobs(const string &key, const string &subkey) override
Check if any BLOB exists (any version)
void SetFlags(TFlags flags) override
Pass flags to the underlying storage.
int GetTimeout() const override
Get expiration timeout.
shared_ptr< ICache > m_Writer
IReader * GetReadStream(const string &key, TBlobVersion version, const string &subkey) override
Return sequential stream interface to read BLOB data.
TTimeStampFlags GetTimeStampPolicy() const override
Get timestamp policy.
TFlags GetFlags() override
ICache overrides.
void Store(const string &key, TBlobVersion version, const string &subkey, const void *data, size_t size, unsigned int time_to_live=0, const string &owner=kEmptyStr) override
Add or replace BLOB.
bool SameCacheParams(const TCacheParams *params) const override
unique_ptr< ICache > m_Main
time_t GetAccessTime(const string &key, TBlobVersion version, const string &subkey) override
Return last access time for the specified cache entry.
string GetCacheName(void) const override
EKeepVersions GetVersionRetention() const override
Get version retention.
size_t GetSize(const string &key, TBlobVersion version, const string &subkey) override
Check if BLOB exists, return BLOB size.
IWriter * GetWriteStream(const string &key, TBlobVersion version, const string &subkey, unsigned int time_to_live=0, const string &owner=kEmptyStr) override
Return sequential stream interface to write BLOB data.
void Purge(time_t access_timeout) override
Delete all BLOBs older than specified.
@ fOwnWriter
Own the underlying writer.
Abstract class for representing single task executing in pool of threads To use this class in applica...
Main class implementing functionality of pool of threads.
definition of a Culling tree
Writer-based output stream.
BLOB cache read/write/maintenance interface.
EKeepVersions
If to keep already cached versions of the BLOB when storing another version of it (not necessarily a ...
int TFlags
Bitwise OR of "EFlags" flags.
EBlobVersionValidity
BLOB version existence and validity â from the point of view of the underlying cache implementation.
int TTimeStampFlags
Holds a bitwise OR of "ETimeStampFlags".
A very basic data-read interface.
A very basic data-write interface.
int main(int argc, const char *argv[])
CDiagContext & GetDiagContext(void)
Get diag context instance.
static void SetRequestContext(CRequestContext *ctx)
Shortcut to CDiagContextThreadData::GetThreadData().SetRequestContext()
static CRequestContext & GetRequestContext(void)
Shortcut to CDiagContextThreadData::GetThreadData().GetRequestContext()
CRef< CRequestContext > Clone(void) const
Copy current request context to a new one.
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
EStatus
Status of the task.
@ eCompleted
executed successfully
@ eCanceled
canceled - possible only if canceled before processing was started or if method Execute() returns res...
CNanoTimeout GetRemainingTime(void) const
Get time left to the expiration.
bool IsExpired(void) const
Check if the deadline is expired.
unsigned long GetAsMilliSeconds(void) const
Get as number of milliseconds.
const string version
version string
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
const struct ncbi::grid::netcache::search::fields::SUBKEY subkey
Magic spell ;-) needed for some weird compilers... very empiric.
void SleepMilliSec(unsigned long ml_sec, EInterruptOnSignal onsignal=eRestartOnSignal)
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
Defines CRequestContext class for NCBI C++ diagnostic API.
Reader-writer based streams.
EStatus Execute(void) override
Do the actual job.
weak_ptr< ICache > m_Cache
SAsyncWriteTask(weak_ptr< ICache > cache, SMeta meta)
weak_ptr< CThreadPool > m_ThreadPool
CRef< SAsyncWriteTask > task
SDeferredExecutor(weak_ptr< CThreadPool > thread_pool, weak_ptr< ICache > cache, SMeta meta)
SDeferredWriter(weak_ptr< CThreadPool > thread_pool, weak_ptr< ICache > cache, SMeta meta)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4