NCBI C++ ToolKit
|
Search Toolkit Book for CNetCacheAPI
Client API for NetCache server. More...
#include <connect/services/netcache_api.hpp>
Public Types | |
enum | ECachingMode { eCaching_AppDefault , eCaching_Disable , eCaching_Enable } |
Allows to define caching behavior on a per-call basis. More... | |
enum | EMirroringMode { eMirroringDisabled , eMirroringEnabled , eIfKeyMirrored } |
Mirroring modes. More... | |
enum | EAppRegistry { eAppRegistry } |
Defines how this object must be initialized. More... | |
enum | ENamedParameterTag { eNPT_BlobTTL , eNPT_CachingMode , eNPT_MirroringMode , eNPT_ServerCheck , eNPT_ServerCheckHint , eNPT_Password , eNPT_ServerToUse , eNPT_ServerLastUsedPtr , eNPT_MaxBlobAge , eNPT_ActualBlobAgePtr , eNPT_UseCompoundID , eNPT_TryAllServers , eNPT_CacheName } |
Named parameters that can be used when calling CNetCacheAPI methods that accept CNamedParameterList. More... | |
enum | EReadResult { eReadComplete , eNotFound , eReadPart } |
Status of GetData() call. More... | |
typedef SNetCacheAPIImpl * | TInstance |
typedef CNamedParameter< unsigned, eNPT_BlobTTL > | TBlobTTL |
Named parameter type for blob life span in seconds. More... | |
typedef CNamedParameter< ECachingMode, eNPT_CachingMode > | TCachingMode |
Named parameter type for caching mode. More... | |
typedef CNamedParameter< EMirroringMode, eNPT_MirroringMode > | TMirroringMode |
Named parameter type for mirroring mode. More... | |
typedef CNamedParameter< ESwitch, eNPT_ServerCheck > | TServerCheck |
Named parameter type for whether blob reading methods must check if the primary server that stores the blob is still in service. More... | |
typedef CNamedParameter< bool, eNPT_ServerCheckHint > | TServerCheckHint |
Named parameter type for whether to advise the readers to check if the primary server that stores the blob is still in service. More... | |
typedef CNamedParameter< string, eNPT_Password > | TBlobPassword |
Named parameter type for blob password. More... | |
typedef CNamedParameter< CNetServer::TInstance, eNPT_ServerToUse > | TServerToUse |
Named parameter type for specifying the server to use for the operation. More... | |
typedef CNamedParameter< CNetServer *, eNPT_ServerLastUsedPtr > | TServerLastUsedPtr |
Named parameter type to supply a pointer to a variable for saving the CNetServer object that was last used. More... | |
typedef CNamedParameter< unsigned, eNPT_MaxBlobAge > | TMaxBlobAge |
Named parameter type to specify that the blob should not be read if its age in seconds is greater than the specified value. More... | |
typedef 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. More... | |
typedef CNamedParameter< bool, eNPT_UseCompoundID > | TUseCompoundID |
Named parameter type to define whether to return NetCache keys in CompoundID format. More... | |
typedef CNamedParameter< bool, eNPT_TryAllServers > | TTryAllServers |
Named parameter type to define whether to run a request through all NetCache servers in the ICache service in an attempt to find the blob. More... | |
typedef CNamedParameter< string, eNPT_CacheName > | TCacheName |
In ICache mode, override the name of the cache specified in the CNetICacheClient constructor. More... | |
Public Member Functions | |
CNetCacheAPI (EVoid) | |
CNetCacheAPI (SNetCacheAPIImpl *impl) | |
CNetCacheAPI & | operator= (SNetCacheAPIImpl *impl) |
operator SNetCacheAPIImpl * () | |
operator const SNetCacheAPIImpl * () const | |
SNetCacheAPIImpl & | operator-- (int) |
const SNetCacheAPIImpl & | operator-- (int) const |
SNetCacheAPIImpl * | operator-> () |
const SNetCacheAPIImpl * | operator-> () const |
CNetCacheAPI () | |
CNetCacheAPI (EAppRegistry use_app_reg, const string &conf_section=kEmptyStr, CNetScheduleAPI::TInstance ns_api=NULL) | |
Creates an instance of CNetCacheAPI and initializes it with parameters read from the application registry. More... | |
CNetCacheAPI (const IRegistry ®, const string &conf_section=kEmptyStr, CNetScheduleAPI::TInstance ns_api=NULL) | |
Constructs a CNetCacheAPI object and initializes it with parameters read from the specified registry object. More... | |
CNetCacheAPI (CConfig *conf, const string &conf_section=kEmptyStr, CNetScheduleAPI::TInstance ns_api=NULL) | |
Constructs a CNetCacheAPI object and initializes it with parameters read from the specified configuration object. More... | |
CNetCacheAPI (const string &client_name, CNetScheduleAPI::TInstance ns_api=NULL) | |
CNetCacheAPI (const string &service_name, const string &client_name, CNetScheduleAPI::TInstance ns_api=NULL) | |
Construct client, working with the specified service. More... | |
void | SetDefaultParameters (const CNamedParameterList *parameters) |
Override defaults used by this object. More... | |
string | PutData (const void *buf, size_t size, const CNamedParameterList *optional=NULL) |
Put BLOB to server. More... | |
IEmbeddedStreamWriter * | PutData (string *key, const CNamedParameterList *optional=NULL) |
Put BLOB to server. More... | |
string | PutData (const string &key, const void *buf, size_t size, const CNamedParameterList *optional=NULL) |
Update an existing BLOB. More... | |
CNcbiOstream * | CreateOStream (string &key, const CNamedParameterList *optional=NULL) |
Create a stream object for sending data to a blob. More... | |
bool | HasBlob (const string &blob_id, const CNamedParameterList *optional=NULL) |
Check if the BLOB identified by the key "key" exists. More... | |
size_t | GetBlobSize (const string &blob_id, const CNamedParameterList *optional=NULL) |
Returns the size of the BLOB identified by the "key" parameter. More... | |
IReader * | GetReader (const string &key, size_t *blob_size=NULL, const CNamedParameterList *optional=NULL) |
Get a pointer to the IReader interface to read blob contents. More... | |
IReader * | GetPartReader (const string &key, size_t offset, size_t part_size, size_t *blob_size=NULL, const CNamedParameterList *optional=NULL) |
Get a pointer to the IReader interface to read a portion of the blob contents. More... | |
void | ReadData (const string &key, string &buffer, const CNamedParameterList *optional=NULL) |
Read the blob pointed to by "key" and store its contents in "buffer". More... | |
void | ReadPart (const string &key, size_t offset, size_t part_size, string &buffer, const CNamedParameterList *optional=NULL) |
Read a part of the blob pointed to by "key" and store its contents in "buffer". More... | |
IReader * | GetData (const string &key, size_t *blob_size=NULL, const CNamedParameterList *optional=NULL) |
Retrieve BLOB from server by key. More... | |
EReadResult | GetData (const string &key, void *buf, size_t buf_size, size_t *n_read=0, size_t *blob_size=0, const CNamedParameterList *optional=NULL) |
Retrieve BLOB from server by key. More... | |
EReadResult | GetData (const string &key, CSimpleBuffer &buffer, const CNamedParameterList *optional=NULL) |
Retrieve BLOB from server by key This method retrieves BLOB size, allocates memory and gets all the data from the server. More... | |
CNcbiIstream * | GetIStream (const string &key, size_t *blob_size=NULL, const CNamedParameterList *optional=NULL) |
Create an istream object for reading blob data. More... | |
void | Remove (const string &blob_id, const CNamedParameterList *optional=NULL) |
Remove BLOB by key. More... | |
CNetServerMultilineCmdOutput | GetBlobInfo (const string &blob_id, const CNamedParameterList *optional=NULL) |
Return a CNetServerMultilineCmdOutput object for reading meta information about the specified blob. More... | |
void | PrintBlobInfo (const string &blob_key, const CNamedParameterList *optional=NULL) |
Print meta information about the specified blob. More... | |
void | ProlongBlobLifetime (const string &blob_key, unsigned ttl, const CNamedParameterList *optional=NULL) |
CNetCacheAdmin | GetAdmin () |
CNetService | GetService () |
void | SetCommunicationTimeout (const STimeout &to) |
CCompoundIDPool | GetCompoundIDPool () |
void | SetCompoundIDPool (CCompoundIDPool::TInstance compound_id_pool) |
Protected Attributes | |
CNetRef< SNetCacheAPIImpl > | m_Impl |
Client API for NetCache server.
It is undesirable to create objects of this class on the heap because they are essentially smart pointers to the implementation objects allocated internally on the heap.
Definition at line 142 of file netcache_api.hpp.