66 unique_ptr<TParams> id_params
68 unique_ptr<TParams> blob_params
74 bool share_id = !share_id_param ||
76 const TParams* share_blob_param =
78 bool share_blob = !share_blob_param ||
80 if (share_id || share_blob) {
82 ICache* cache = cache_manager.
91 ICache* cache = cache_manager.
129 size_t old_size =
size();
130 size_t new_size = (old_size+add)*2;
131 char* new_buf =
new char[new_size];
132 memcpy(new_buf,
data(), old_size);
135 m_Ptr = new_buf + old_size;
136 m_End = new_buf + new_size;
144 size_t size = s.size();
146 x_StoreUint4(ToUint4(
size));
147 memcpy(m_Ptr, s.data(),
size);
154 if ( m_Buffer != m_Buffer0 ) {
156 m_Buffer = m_End = m_Ptr = 0;
173 catch ( exception& ) {
279 str.StoreBool(
data.sequence_found);
280 str.StoreBool(
data.hash_known);
336 unique_ptr<IWriter> writer
338 if ( !writer.get() ) {
348 obj_stream << *it->GetSeqId();
351 catch ( exception& ) {
357 catch ( exception& ) {
377 string subkey, true_subkey;
387 str.StoreInt4(
id.GetSat());
388 str.StoreInt4(
id.GetSubSat());
389 str.StoreInt4(
id.GetSatKey());
390 str.StoreUint4(
info.GetContentsMask());
397 str.StoreString(*it2);
403 if ( !annot_info || annot_info->
GetAnnotInfo().empty() ) {
418 if ( !true_subkey.empty() ) {
419 str.StoreString(true_subkey);
438 str.StoreInt4(blob_state);
479 if ( m_Writer.get() ) {
480 m_Stream.reset(
new CWStream(m_Writer.get()));
485 if ( m_Stream.get() ) {
492 return m_Stream.get() != 0;
521 m_Cache->Remove(m_Key, m_Version, m_Subkey);
523 catch ( exception& ) {
555 if ( version_lock ) {
564 if ( !stream->CanWrite() ) {
571 catch ( exception& ) {
609 if ( !driver.empty() && driver != m_DriverName )
SCacheInfo::TParams * GetCacheParams(const SCacheInfo::TParams *src_params, SCacheInfo::EReaderOrWriter reader_or_writer, SCacheInfo::EIdOrBlob id_or_blob)
const TAnnotInfo & GetAnnotInfo(void) const
const TNamedAnnotNames & GetNamedAnnotNames(void) const
vector< CConstRef< CID2S_Seq_annot_Info > > TAnnotInfo
unique_ptr< CWStream > m_Stream
CCacheBlobStream(ICache *cache, const string &key, TVersion version, const string &subkey)
unique_ptr< IWriter > m_Writer
bool CanWrite(void) const
CNcbiOstream & operator*(void)
void SetIdCache(ICache *id_cache)
void SetBlobCache(ICache *blob_cache)
static bool NoNeedToSave(ECacheEntryType type)
@ eCacheEntry_BlobVersion
Class factory for Cache writer.
CWriter * CreateInstance(const string &driver=kEmptyStr, CVersionInfo version=NCBI_INTERFACE_VERSION(CWriter), const TPluginManagerParamTree *params=0) const
Create instance of TDriver.
CSimpleClassFactoryImpl< CWriter, CCacheWriter > TParent
const char * data(void) const
static Uint4 ToUint4(size_t size)
void StoreString(const string &s)
void CheckSpace(size_t size)
virtual void SaveSequenceType(CReaderRequestResult &result, const CSeq_id_Handle &seq_id)
virtual bool CanWrite(EType type) const
virtual void InitializeCache(CReaderCacheManager &cache_manager, const TPluginManagerParamTree *params)
virtual void SaveSeq_idTaxId(CReaderRequestResult &result, const CSeq_id_Handle &seq_id)
virtual void SaveSeq_idAccVer(CReaderRequestResult &result, const CSeq_id_Handle &seq_id)
void x_WriteId(const string &key, const string &subkey, const char *data, size_t size)
virtual void SaveSequenceLength(CReaderRequestResult &result, const CSeq_id_Handle &seq_id)
virtual void SaveSeq_idLabel(CReaderRequestResult &result, const CSeq_id_Handle &seq_id)
void WriteSeq_ids(const string &key, const CLoadLockSeqIds &ids)
virtual void SaveSeq_idGi(CReaderRequestResult &result, const CSeq_id_Handle &seq_id)
virtual void ResetCache(void)
virtual void SaveSequenceHash(CReaderRequestResult &result, const CSeq_id_Handle &seq_id)
virtual void SaveSeq_idBlob_ids(CReaderRequestResult &result, const CSeq_id_Handle &seq_id, const SAnnotSelector *sel)
virtual CRef< CBlobStream > OpenBlobStream(CReaderRequestResult &result, const TBlobId &blob_id, TChunkId chunk_id, const CProcessor &processor)
virtual void SaveBlobState(CReaderRequestResult &result, const TBlobId &blob_id, TBlobState blob_state)
virtual void SaveSeq_idSeq_ids(CReaderRequestResult &result, const CSeq_id_Handle &seq_id)
virtual void SaveBlobVersion(CReaderRequestResult &result, const TBlobId &blob_id, TBlobVersion version)
TState GetState(void) const
static bool IsFound(const TData &data)
TData GetAccVer(void) const
static const CSeq_id_Handle & GetAcc(const TData &data)
bool IsLoadedAccVer(void) const
static GBL::EExpirationType GetExpType(const TData &data)
static GBL::EExpirationType GetExpType(const TData &data)
TData GetBlob_ids(void) const
TData GetBlobVersion(void) const
TBlobVersion GetKnownBlobVersion(void) const
bool IsLoadedGi(void) const
static bool IsFound(const TData &data)
static TGi GetGi(const TData &data)
static GBL::EExpirationType GetExpType(const TData &data)
static GBL::EExpirationType GetExpType(const TData &data)
bool IsLoadedHash(void) const
static int GetHash(const TData &data)
static GBL::EExpirationType GetExpType(const TData &data)
bool IsLoadedLabel(void) const
TData GetLabel(void) const
TData GetLength(void) const
bool IsLoadedLength(void) const
static GBL::EExpirationType GetExpType(const TData &data)
TData GetSeq_ids(void) const
static GBL::EExpirationType GetExpType(const TData &data)
bool IsLoadedTaxId(void) const
TData GetTaxId(void) const
static GBL::EExpirationType GetExpType(const TData &data)
static CSeq_inst::TMol GetType(const TData &data)
bool IsLoadedType(void) const
static GBL::EExpirationType GetExpType(const TData &data)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
CObjectOStreamAsnBinary –.
static bool IsExtAnnot(const TBlobId &blob_id)
virtual void RegisterCache(ICache &cache, ECacheType cache_type)=0
Template class helps to implement one driver class factory.
definition of a Culling tree
Writer-based output stream.
static void WriteProcessorTag(CNcbiOstream &stream, const CProcessor &processor)
BLOB cache read/write/maintenance interface.
virtual void Remove(const string &key, TBlobVersion version, const string &subkey)=0
Remove specific cache entry.
virtual IWriter * GetWriteStream(const string &key, TBlobVersion version, const string &subkey, unsigned int time_to_live=0, const string &owner=kEmptyStr)=0
Return sequential stream interface to write BLOB data.
virtual 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)=0
Add or replace BLOB.
static const struct name_t names[]
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define TAX_ID_TO(T, tax_id)
const TSeqPos kInvalidSeqPos
Define special value for invalid sequence position.
NCBI_XNCBI_EXPORT void Abort(void)
Smart abort function.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
string AsString(void) const
static void NCBI_EntryPointImpl(TDriverInfoList &info_list, EEntryPointRequest method)
Entry point implementation.
#define NCBI_INTERFACE_VERSION(iface)
Macro to construct CVersionInfo class using interface name (relies on CInterfaceVersion class)
list< SDriverInfo > TDriverInfoList
List of driver information.
EEntryPointRequest
Actions performed by the entry point.
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static bool StringToBool(const CTempString str)
Convert string to bool.
const TTreeType * FindNode(const TKeyType &key, TNodeSearchMode sflag=eImmediateAndTop) const
Search for node.
const TValue & GetValue(void) const
Return node's value.
Interfaces for a local cache of versioned binary large objects (BLOBS).
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
#define NCBI_GBLOADER_WRITER_CACHE_DRIVER_NAME
#define NCBI_GBLOADER_WRITER_CACHE_PARAM_SHARE
Reader-writer based streams.
Better replacement of GetAccVer(), this method should be defined in data loaders, GetAccVer() is left...
Better replacement of GetGi(), this method should be defined in data loaders, GetGi() is left for com...
Better replacement of GetSequenceHash(), this method should be defined in data loaders,...
static void GetBlob_idsSubkey(const SAnnotSelector *sel, string &subkey, string &true_subkey)
Id cache subkeys:
static ICache * CreateCache(const TParams *params, EReaderOrWriter reader_or_writer, EIdOrBlob id_or_blob)
static string GetBlobSubkey(CLoadLockBlob &blob, int chunk_id=kMain_ChunkId)
BLOB cache subkeys:
static string GetIdKey(const CSeq_id &id)
Return Id cache key string based on CSeq_id of gi.
static const char * GetAccVerSubkey(void)
static const char * GetTypeSubkey(void)
static const char * GetBlobStateSubkey(void)
static const char * GetGiSubkey(void)
static int GetDebugLevel(void)
static const char * GetHashSubkey(void)
static const char * GetLabelSubkey(void)
static const char * GetLengthSubkey(void)
static const char * GetTaxIdSubkey(void)
static const char * GetSeq_idsSubkey(void)
static const char * GetBlobVersionSubkey(void)
static string GetBlobKey(const CBlob_id &blob_id)
Return BLOB cache key string based on Sat() and SatKey()
static const int BLOB_IDS_MAGIC
void GenBankWriters_Register_Cache(void)
void NCBI_EntryPoint_CacheWriter(CPluginManager< CWriter >::TDriverInfoList &info_list, CPluginManager< CWriter >::EEntryPointRequest method)
void NCBI_EntryPoint_xwriter_cache(CPluginManager< CWriter >::TDriverInfoList &info_list, CPluginManager< CWriter >::EEntryPointRequest method)