1 #ifndef CONN___NETCACHE_API__HPP
2 #define CONN___NETCACHE_API__HPP
63 #define nc_blob_ttl CNetCacheAPI::TBlobTTL()
67 #define nc_caching_mode CNetCacheAPI::TCachingMode()
71 #define nc_mirroring_mode CNetCacheAPI::TMirroringMode()
76 #define nc_server_check CNetCacheAPI::TServerCheck()
81 #define nc_server_check_hint CNetCacheAPI::TServerCheckHint()
86 #define nc_blob_password CNetCacheAPI::TBlobPassword()
91 #define nc_server_to_use CNetCacheAPI::TServerToUse()
96 #define nc_server_last_used CNetCacheAPI::TServerLastUsedPtr()
100 #define nc_max_age CNetCacheAPI::TMaxBlobAge()
105 #define nc_actual_age CNetCacheAPI::TActualBlobAgePtr()
109 #define nc_use_compound_id CNetCacheAPI::TUseCompoundID()
114 #define nc_try_all_servers CNetCacheAPI::TTryAllServers()
119 #define nc_cache_name CNetCacheAPI::TCacheName()
207 CNetCacheAPI(
const string& service_name,
const string& client_name,
255 string PutData(
const void*
buf,
size_t size,
278 string PutData(
const string&
key,
303 bool HasBlob(
const string& blob_id,
320 size_t GetBlobSize(
const string& blob_id,
365 size_t offset,
size_t part_size,
size_t* blob_size =
NULL,
376 void ReadData(
const string&
key,
string&
buffer,
387 void ReadPart(
const string&
key,
432 EReadResult GetData(
const string&
key,
436 size_t* blob_size = 0,
459 void Remove(
const string& blob_id,
471 void PrintBlobInfo(
const string& blob_key,
474 void ProlongBlobLifetime(
const string& blob_key,
unsigned ttl,
482 {GetService().GetServerPool().SetCommunicationTimeout(to);}
619 m_NCClient(nc_client) {}
624 virtual bool IsKeyValid(
const string&
str);
630 virtual string GetBlobAsString(
const string& data_id);
641 size_t* blob_size_ptr = 0,
642 ELockMode lock_mode = eLockWait);
652 ELockMode lock_mode = eLockNoWait);
658 virtual string CreateEmptyBlob();
664 virtual void DeleteBlob(
const string& data_id);
667 virtual void Reset();
CBlobStorage_NetCache – NetCache-based implementation of IBlobStorage.
Pool of recycled CCompoundID objects.
Client API for NetCache server.
SNetServerImpl * TInstance
Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit...
A very basic data-read interface.
static const char * str(char *buf, int n)
CNamedParameter< CNetServer *, eNPT_ServerLastUsedPtr > TServerLastUsedPtr
Named parameter type to supply a pointer to a variable for saving the CNetServer object that was last...
CNamedParameter< EMirroringMode, eNPT_MirroringMode > TMirroringMode
Named parameter type for mirroring mode.
ECachingMode
Allows to define caching behavior on a per-call basis.
CNamedParameter< unsigned, eNPT_BlobTTL > TBlobTTL
Named parameter type for blob life span in seconds.
EMirroringMode
Mirroring modes.
const char *const kNetCacheAPIDriverName
CNamedParameter< bool, eNPT_UseCompoundID > TUseCompoundID
Named parameter type to define whether to return NetCache keys in CompoundID format.
CNamedParameter< bool, eNPT_TryAllServers > TTryAllServers
Named parameter type to define whether to run a request through all NetCache servers in the ICache se...
CNamedParameter< unsigned *, eNPT_ActualBlobAgePtr > TActualBlobAgePtr
Named parameter type for a pointer to a variable where the actual age of the blob is to be stored.
unique_ptr< CNcbiOstream > m_OStream
CNamedParameter< ECachingMode, eNPT_CachingMode > TCachingMode
Named parameter type for caching mode.
void NCBI_EntryPoint_xnetcacheapi(CPluginManager< SNetCacheAPIImpl >::TDriverInfoList &info_list, CPluginManager< SNetCacheAPIImpl >::EEntryPointRequest method)
CNamedParameter< ESwitch, eNPT_ServerCheck > TServerCheck
Named parameter type for whether blob reading methods must check if the primary server that stores th...
EAppRegistry
Defines how this object must be initialized.
unique_ptr< CNcbiIstream > m_IStream
CBlobStorage_NetCache(CNetCacheAPI::TInstance nc_client)
Create Blob Storage.
ENamedParameterTag
Named parameters that can be used when calling CNetCacheAPI methods that accept CNamedParameterList.
CNetCacheAPI GetNetCacheAPI() const
CBlobStorage_NetCache & operator=(CBlobStorage_NetCache &)
void SetCommunicationTimeout(const STimeout &to)
CNamedParameter< CNetServer::TInstance, eNPT_ServerToUse > TServerToUse
Named parameter type for specifying the server to use for the operation.
CNamedParameter< unsigned, eNPT_MaxBlobAge > TMaxBlobAge
Named parameter type to specify that the blob should not be read if its age in seconds is greater tha...
CNamedParameter< string, eNPT_Password > TBlobPassword
Named parameter type for blob password.
CBlobStorage_NetCache(const CBlobStorage_NetCache &)
EReadResult
Status of GetData() call.
CNamedParameter< string, eNPT_CacheName > TCacheName
In ICache mode, override the name of the cache specified in the CNetICacheClient constructor.
NCBI_DECLARE_INTERFACE_VERSION(SNetCacheAPIImpl, "xnetcacheapi", 1, 1, 0)
CNamedParameter< bool, eNPT_ServerCheckHint > TServerCheckHint
Named parameter type for whether to advise the readers to check if the primary server that stores the...
@ eNotFound
BLOB not found or error.
@ eReadComplete
The whole BLOB has been read.
list< SDriverInfo > TDriverInfoList
List of driver information.
EEntryPointRequest
Actions performed by the entry point.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
#define NCBI_XCONNECT_EXPORT
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
Administrative API for NetCache.
NetCache API exception declarations.
#define NCBI_NET_COMPONENT(component)
NetSchedule client specs.
Plugin manager (using class factory paradigm).
unique_ptr< CObjectIStream > GetIStream(string path, ESerialDataFormat serial_format)