NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Attributes | List of all members

Search Toolkit Book for CNetCacheAPI

Client API for NetCache server. More...

#include <connect/services/netcache_api.hpp>

+ Inheritance diagram for CNetCacheAPI:
+ Collaboration diagram for CNetCacheAPI:

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 SNetCacheAPIImplTInstance
 
typedef CNamedParameter< unsigned, eNPT_BlobTTLTBlobTTL
 Named parameter type for blob life span in seconds. More...
 
typedef CNamedParameter< ECachingMode, eNPT_CachingModeTCachingMode
 Named parameter type for caching mode. More...
 
typedef CNamedParameter< EMirroringMode, eNPT_MirroringModeTMirroringMode
 Named parameter type for mirroring mode. More...
 
typedef CNamedParameter< ESwitch, eNPT_ServerCheckTServerCheck
 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_ServerCheckHintTServerCheckHint
 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_PasswordTBlobPassword
 Named parameter type for blob password. More...
 
typedef CNamedParameter< CNetServer::TInstance, eNPT_ServerToUseTServerToUse
 Named parameter type for specifying the server to use for the operation. More...
 
typedef CNamedParameter< CNetServer *, eNPT_ServerLastUsedPtrTServerLastUsedPtr
 Named parameter type to supply a pointer to a variable for saving the CNetServer object that was last used. More...
 
typedef CNamedParameter< unsigned, eNPT_MaxBlobAgeTMaxBlobAge
 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_ActualBlobAgePtrTActualBlobAgePtr
 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_UseCompoundIDTUseCompoundID
 Named parameter type to define whether to return NetCache keys in CompoundID format. More...
 
typedef CNamedParameter< bool, eNPT_TryAllServersTTryAllServers
 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_CacheNameTCacheName
 In ICache mode, override the name of the cache specified in the CNetICacheClient constructor. More...
 

Public Member Functions

 CNetCacheAPI (EVoid)
 
 CNetCacheAPI (SNetCacheAPIImpl *impl)
 
CNetCacheAPIoperator= (SNetCacheAPIImpl *impl)
 
 operator SNetCacheAPIImpl * ()
 
 operator const SNetCacheAPIImpl * () const
 
SNetCacheAPIImploperator-- (int)
 
const SNetCacheAPIImploperator-- (int) const
 
SNetCacheAPIImploperator-> ()
 
const SNetCacheAPIImploperator-> () 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 &reg, 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...
 
IEmbeddedStreamWriterPutData (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...
 
CNcbiOstreamCreateOStream (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...
 
IReaderGetReader (const string &key, size_t *blob_size=NULL, const CNamedParameterList *optional=NULL)
 Get a pointer to the IReader interface to read blob contents. More...
 
IReaderGetPartReader (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...
 
IReaderGetData (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...
 
CNcbiIstreamGetIStream (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< SNetCacheAPIImplm_Impl
 

Detailed Description

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.

Note
After sending blob data to a NetCache server, this class waits for a confirmation from the server, and the connection cannot be used before this confirmation is read.

Definition at line 142 of file netcache_api.hpp.


The documentation for this class was generated from the following files:
Modified on Tue Sep 03 11:04:56 2024 by modify_doxy.py rev. 669887