NCBI C++ ToolKit
netcache_api.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef CONN___NETCACHE_API__HPP
2 #define CONN___NETCACHE_API__HPP
3 
4 /* $Id: netcache_api.hpp 84368 2018-11-05 16:55:15Z sadyrovr $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Anatoliy Kuznetsov, Maxim Didenko, Dmitry Kazimirov
30  *
31  * File Description:
32  * Net cache client API.
33  *
34  */
35 
36 /// @file netcache_api.hpp
37 /// NetCache client specs.
38 ///
39 
40 #include "netschedule_api.hpp"
41 #include "netcache_admin.hpp"
42 #include "netcache_api_expt.hpp"
43 #include "netcache_key.hpp"
44 #include "named_parameters.hpp"
45 
46 #include <util/simple_buffer.hpp>
47 
49 #include <corelib/blob_storage.hpp>
50 
51 
53 
54 
55 /** @addtogroup NetCacheClientParams
56  *
57  * @{
58  */
59 
60 /// Blob life span in seconds. If zero or greater than the
61 /// server-side value, then the server-side TTL is used.
62 /// @see CNetCacheAPI::TBlobTTL
63 #define nc_blob_ttl CNetCacheAPI::TBlobTTL()
64 
65 /// Caching mode.
66 /// @see CNetCacheAPI::TCachingMode for details.
67 #define nc_caching_mode CNetCacheAPI::TCachingMode()
68 
69 /// Mirroring mode.
70 /// @see CNetCacheAPI::EMirroringMode for details.
71 #define nc_mirroring_mode CNetCacheAPI::TMirroringMode()
72 
73 /// For blob readers: whether to check if the primary
74 /// server that stores the blob is still in service.
75 /// @see CNetCacheAPI::TServerCheck
76 #define nc_server_check CNetCacheAPI::TServerCheck()
77 
78 /// For blob writers: whether to advise the readers to check
79 /// if the primary server that stores the blob is still in service.
80 /// @see CNetCacheAPI::TServerCheckHint
81 #define nc_server_check_hint CNetCacheAPI::TServerCheckHint()
82 
83 /// Blob password. Used to protect the blob when writing;
84 /// required for reading a password-protected blob.
85 /// @see CNetCacheAPI::TBlobPassword
86 #define nc_blob_password CNetCacheAPI::TBlobPassword()
87 
88 /// The server to use for the operation. Overrides whatever is
89 /// defined in the constructor or the configuration file.
90 /// @see CNetCacheAPI::TServerToUse
91 #define nc_server_to_use CNetCacheAPI::TServerToUse()
92 
93 /// Pointer to a variable for saving the CNetServer that was last used.
94 /// Works only with (some of) CNetICacheClient methods.
95 /// @see CNetCacheAPI::TServerLastUsedPtr
96 #define nc_server_last_used CNetCacheAPI::TServerLastUsedPtr()
97 
98 /// Do not read the blob if its age is greater than the specified value.
99 /// @see CNetCacheAPI::TMaxBlobAge
100 #define nc_max_age CNetCacheAPI::TMaxBlobAge()
101 
102 /// A pointer to an unsigned variable where the actual age of the blob
103 /// must be stored.
104 /// @see CNetCacheAPI::TActualBlobAgePtr
105 #define nc_actual_age CNetCacheAPI::TActualBlobAgePtr()
106 
107 /// Whether to return NetCache keys in CompoundID format.
108 /// @see CNetCacheAPI::TUseCompoundID
109 #define nc_use_compound_id CNetCacheAPI::TUseCompoundID()
110 
111 /// Whether to run a request through all NetCache servers in the
112 /// ICache service in an attempt to find the blob.
113 /// @see CNetCacheAPI::TTryAllServers
114 #define nc_try_all_servers CNetCacheAPI::TTryAllServers()
115 
116 /// In ICache mode, override the name of the cache specified
117 /// in the CNetICacheClient constructor.
118 /// @see CNetCacheAPI::TCacheName
119 #define nc_cache_name CNetCacheAPI::TCacheName()
120 
121 /* @} */
122 
123 /** @addtogroup NetCacheClient
124  *
125  * @{
126  */
127 
128 struct SNetCacheAPIImpl;
129 
130 /// Client API for NetCache server.
131 ///
132 /// It is undesirable to create objects of this class on the heap
133 /// because they are essentially smart pointers to the implementation
134 /// objects allocated internally on the heap.
135 ///
136 /// @note After sending blob data to a NetCache server,
137 /// this class waits for a confirmation from the server,
138 /// and the connection cannot be used before this
139 /// confirmation is read.
140 ///
141 ///
143 {
144  NCBI_NET_COMPONENT(NetCacheAPI);
145 
146  /// Allows to define caching behavior on a per-call basis.
150  eCaching_Enable
151  };
152 
153  /// Mirroring modes. eIfKeyMirrored unconditionally enables
154  /// mirroring for blobs that were created in mirroring mode.
158  eIfKeyMirrored
159  };
160 
161  /// Defines how this object must be initialized.
163  eAppRegistry
164  };
165 
166  /// Creates an instance of CNetCacheAPI and initializes
167  /// it with parameters read from the application registry.
168  /// @param use_app_reg
169  /// Selects this constructor.
170  /// The parameter is not used otherwise.
171  /// @param conf_section
172  /// Name of the registry section to look for the configuration
173  /// parameters in. If empty string is passed, then the section
174  /// name "netcache_api" will be used.
175  explicit CNetCacheAPI(EAppRegistry use_app_reg,
176  const string& conf_section = kEmptyStr,
178 
179  /// Constructs a CNetCacheAPI object and initializes it with
180  /// parameters read from the specified registry object.
181  /// @param reg
182  /// Registry to get the configuration parameters from.
183  /// @param conf_section
184  /// Name of the registry section to look for the configuration
185  /// parameters in. If empty string is passed, then the section
186  /// name "netcache_api" will be used.
187  explicit CNetCacheAPI(const IRegistry& reg,
188  const string& conf_section = kEmptyStr,
190 
191  /// Constructs a CNetCacheAPI object and initializes it with
192  /// parameters read from the specified configuration object.
193  /// @param conf
194  /// A CConfig object to get the configuration parameters from.
195  /// @param conf_section
196  /// Name of the configuration section where to look for the
197  /// parameters. If empty string is passed, then the section
198  /// name "netcache_api" will be used.
199  explicit CNetCacheAPI(CConfig* conf,
200  const string& conf_section = kEmptyStr,
202 
203  explicit CNetCacheAPI(const string& client_name,
205 
206  /// Construct client, working with the specified service
207  CNetCacheAPI(const string& service_name, const string& client_name,
209 
210  /// Named parameters that can be used when calling
211  /// CNetCacheAPI methods that accept CNamedParameterList.
226  };
227 
228  /// Override defaults used by this object.
229  ///
230  /// @param parameters
231  /// A list of named parameters, for example:
232  /// SetDefaultParameters(use_compound_id = true);
233  ///
234  /// @warning
235  /// This method is not thread-safe (it cannot be called
236  /// concurrently from multiple threads on the same object).
237  ///
238  void SetDefaultParameters(const CNamedParameterList* parameters);
239 
240  /// Put BLOB to server. This method is blocking and waits
241  /// for a confirmation from NetCache after all data is
242  /// transferred.
243  ///
244  /// @param buf
245  /// Data to be written.
246  /// @param size
247  /// Number of bytes to write.
248  /// @param optional
249  /// An optional list of named blob creation parameters in the
250  /// form of (param_name = param_value, ...).
251  /// @see NetCacheClientParams
252  ///
253  /// @return NetCache blob key
254  ///
255  string PutData(const void* buf, size_t size,
256  const CNamedParameterList* optional = NULL);
257 
258  /// Put BLOB to server. This method is blocking, it
259  /// waits for a confirmation from NetCache after all
260  /// data is transferred. Since blob EOF marker is sent in the
261  /// destructor, the blob will not be created until the stream
262  /// is deleted.
263  ///
264  /// @param key
265  /// NetCache key, if empty new key is created
266  /// @param optional
267  /// An optional list of named blob creation parameters in the
268  /// form of (param_name = param_value, ...).
269  /// @see NetCacheClientParams
270  /// @return
271  /// IEmbeddedStreamWriter* (caller must delete it).
272  IEmbeddedStreamWriter* PutData(string* key,
273  const CNamedParameterList* optional = NULL);
274 
275  /// Update an existing BLOB. Just like all other PutData
276  /// methods, this one is blocking and waits for a confirmation
277  /// from NetCache after all data is transferred.
278  string PutData(const string& key,
279  const void* buf,
280  size_t size,
281  const CNamedParameterList* optional = NULL);
282 
283  /// Create a stream object for sending data to a blob.
284  /// If the string "key" is empty, a new blob will be created
285  /// and its ID will be returned via the "key" parameter.
286  /// @note
287  /// The blob will not be available from NetCache until
288  /// the stream is destructed.
289  CNcbiOstream* CreateOStream(string& key,
290  const CNamedParameterList* optional = NULL);
291 
292  /// Check if the BLOB identified by the key "key" exists.
293  ///
294  /// @param key
295  /// Key of the BLOB to check for existence.
296  /// @param optional
297  /// An optional list of named blob creation parameters in the
298  /// form of (param_name = param_value, ...).
299  /// @see NetCacheClientParams
300  ///
301  /// @return
302  /// True, if the BLOB exists; false otherwise.
303  bool HasBlob(const string& blob_id,
304  const CNamedParameterList* optional = NULL);
305 
306  /// Returns the size of the BLOB identified by the "key" parameter.
307  ///
308  /// @note
309  /// This updates the blob's expiration time.
310  ///
311  /// @param key
312  /// The key of the BLOB the size of which to be returned.
313  /// @param optional
314  /// An optional list of named blob creation parameters in the
315  /// form of (param_name = param_value, ...).
316  /// @see NetCacheClientParams
317  ///
318  /// @return
319  /// Size of the BLOB in bytes.
320  size_t GetBlobSize(const string& blob_id,
321  const CNamedParameterList* optional = NULL);
322 
323  /// Get a pointer to the IReader interface to read blob contents.
324  /// This is a safe version of the GetData method having the same
325  /// signature. Unlike GetData, GetReader will throw an exception
326  /// if the requested blob is not found.
327  ///
328  /// @note
329  /// The Read() method of the returned IReader object is not
330  /// blocking. A reading completion loop is required, see an
331  /// example below.
332  ///
333  /// @code
334  /// size_t blob_size;
335  /// unique_ptr<IReader> reader(nc_api.GetReader(key, &blob_size,
336  /// nc_caching_mode = CNetCacheAPI::eCaching_Disable));
337  /// size_t bytes_read;
338  /// size_t total_bytes_read = 0;
339  ///
340  /// while (buf_size > 0) {
341  /// ERW_Result rw_res = reader->Read(buf_ptr, buf_size, &bytes_read);
342  /// if (rw_res == eRW_Success) {
343  /// total_bytes_read += bytes_read;
344  /// buf_ptr += bytes_read;
345  /// buf_size -= bytes_read;
346  /// } else if (rw_res == eRW_Eof) {
347  /// break;
348  /// } else {
349  /// NCBI_THROW(CNetServiceException, eCommunicationError,
350  /// "Error while reading BLOB");
351  /// }
352  /// }
353  ///
354  /// return total_bytes_read;
355  /// @endcode
356  IReader* GetReader(const string& key, size_t* blob_size = NULL,
357  const CNamedParameterList* optional = NULL);
358 
359  /// Get a pointer to the IReader interface to read a portion of
360  /// the blob contents. See the description of GetReader() for details.
361  /// The Read() method of the returned IReader interface implementation
362  /// is not blocking.
363  /// @see CNetCacheAPI::GetReader() for details.
364  IReader* GetPartReader(const string& key,
365  size_t offset, size_t part_size, size_t* blob_size = NULL,
366  const CNamedParameterList* optional = NULL);
367 
368  /// Read the blob pointed to by "key" and store its contents
369  /// in "buffer". The output string is resized as required.
370  ///
371  /// @throw CNetCacheException
372  /// Thrown if either the blob was not found or
373  /// a protocol error occurred.
374  /// @throw CNetServiceException
375  /// Thrown if a communication error occurred.
376  void ReadData(const string& key, string& buffer,
377  const CNamedParameterList* optional = NULL);
378 
379  /// Read a part of the blob pointed to by "key" and store its contents
380  /// in "buffer". The output string is resized as required.
381  ///
382  /// @throw CNetCacheException
383  /// Thrown if either the blob was not found or
384  /// a protocol error occurred.
385  /// @throw CNetServiceException
386  /// Thrown if a communication error occurred.
387  void ReadPart(const string& key,
388  size_t offset, size_t part_size, string& buffer,
389  const CNamedParameterList* optional = NULL);
390 
391  /// Retrieve BLOB from server by key.
392  //
393  /// Caller is responsible for deletion of the IReader* object.
394  /// It must be deleted before the destruction of CNetCacheAPI.
395  ///
396  /// @note
397  /// IReader implementation used here is based on TCP/IP
398  /// sockets; when reading the blob, please remember to check
399  /// IReader::Read return codes, it may not be able to read
400  /// the whole blob in one call because of network delays.
401  /// @see CNetCacheAPI::GetReader() for details.
402  ///
403  /// @param key
404  /// BLOB key to read (returned by PutData)
405  /// @param blob_size
406  /// Pointer to the memory location where the size
407  /// of the requested blob will be stored.
408  /// @param optional
409  /// An optional list of named blob creation parameters in the
410  /// form of (param_name = param_value, ...).
411  /// @see NetCacheClientParams
412  /// @return
413  /// If the requested blob is found, the method returns a pointer
414  /// to the IReader interface for reading the blob contents (the
415  /// caller must delete it). If the blob is not found (that is,
416  /// if it's expired), NULL is returned.
417  IReader* GetData(const string& key, size_t* blob_size = NULL,
418  const CNamedParameterList* optional = NULL);
419 
420  /// Status of GetData() call
421  /// @sa GetData
422  enum EReadResult {
423  eReadComplete, ///< The whole BLOB has been read
424  eNotFound, ///< BLOB not found or error
425  eReadPart ///< Read part of the BLOB (buffer capacity)
426  };
427 
428  /// Retrieve BLOB from server by key
429  ///
430  /// @note
431  /// Function waits for enough data to arrive.
432  EReadResult GetData(const string& key,
433  void* buf,
434  size_t buf_size,
435  size_t* n_read = 0,
436  size_t* blob_size = 0,
437  const CNamedParameterList* optional = NULL);
438 
439  /// Retrieve BLOB from server by key
440  /// This method retrieves BLOB size, allocates memory and gets all
441  /// the data from the server.
442  ///
443  /// Blob size and binary data is placed into blob_to_read structure.
444  /// Do not use this method if you are not sure you have memory
445  /// to load the whole BLOB.
446  ///
447  /// @return
448  /// eReadComplete if BLOB found (eNotFound otherwise)
449  EReadResult GetData(const string& key, CSimpleBuffer& buffer,
450  const CNamedParameterList* optional = NULL);
451 
452  /// Create an istream object for reading blob data.
453  /// @throw CNetCacheException
454  /// The requested blob does not exist.
455  CNcbiIstream* GetIStream(const string& key, size_t* blob_size = NULL,
456  const CNamedParameterList* optional = NULL);
457 
458  /// Remove BLOB by key
459  void Remove(const string& blob_id,
460  const CNamedParameterList* optional = NULL);
461 
462  /// Return a CNetServerMultilineCmdOutput object for reading
463  /// meta information about the specified blob.
464  ///
465  /// @note
466  /// This does not update the blob's expiration time.
467  CNetServerMultilineCmdOutput GetBlobInfo(const string& blob_id,
468  const CNamedParameterList* optional = NULL);
469 
470  /// Print meta information about the specified blob.
471  void PrintBlobInfo(const string& blob_key,
472  const CNamedParameterList* optional = NULL);
473 
474  void ProlongBlobLifetime(const string& blob_key, unsigned ttl,
475  const CNamedParameterList* optional = NULL);
476 
477  CNetCacheAdmin GetAdmin();
478 
479  CNetService GetService();
480 
482  {GetService().GetServerPool().SetCommunicationTimeout(to);}
483 
484  /// Named parameter type for blob life span in seconds.
485  /// If zero or greater than the server-side value,
486  /// then the server-side TTL is used.
487  /// This type of parameter can be defined through the nc_blob_ttl
488  /// macro substitution, for example:
489  /// nc_blob_ttl = 600
490  /// @see nc_blob_ttl
492 
493  /// Named parameter type for caching mode.
494  /// This type of parameter can be defined through the
495  /// nc_caching_mode macro substitution, for example:
496  /// nc_caching_mode = CNetCacheAPI::eCaching_Disable
497  /// @see nc_caching_mode, ECachingMode
499 
500  /// Named parameter type for mirroring mode.
501  /// This type of parameter can be defined through the
502  /// nc_mirroring_mode macro substitution, for example:
503  /// nc_mirroring_mode = CNetCacheAPI::eMirroringEnabled
504  /// @see nc_mirroring_mode, EMirroringMode
506 
507  /// Named parameter type for whether blob reading methods
508  /// must check if the primary server that stores the blob
509  /// is still in service.
510  /// This type of parameter can be defined through the nc_server_check
511  /// macro substitution, for example:
512  /// nc_server_check = eOn
513  /// @see nc_server_check
515 
516  /// Named parameter type for whether to advise the readers to check
517  /// if the primary server that stores the blob is still in service.
518  /// This type parameter only has effect during blob creation and
519  /// can be defined through the nc_server_check_hint macro substitution,
520  /// for example:
521  /// nc_server_check_hint = true
522  /// @see nc_server_check_hint
524 
525  /// Named parameter type for blob password. A blob created with a
526  /// password cannot be read without specifying the same password.
527  /// This type of parameter can be defined through the nc_blob_password
528  /// macro substitution, for example:
529  /// nc_blob_password = "secret"
530  /// @see nc_blob_password
532 
533  /// Named parameter type for specifying the server to use
534  /// for the operation. Overrides whatever is defined in the
535  /// constructor or the configuration file.
536  /// This type of parameter can be defined through the nc_server_to_use
537  /// macro substitution, for example:
538  /// nc_server_to_use = netserver_object
539  /// @see nc_server_to_use
541  eNPT_ServerToUse> TServerToUse;
542 
543  /// Named parameter type to supply a pointer to a variable for saving
544  /// the CNetServer object that was last used. This parameter works
545  /// only with (some of) CNetICacheClient methods.
546  /// This type of parameter can be defined through the nc_server_last_used
547  /// macro substitution, for example:
548  /// nc_server_last_used = &netserver_object
549  /// @see nc_server_last_used
550  typedef CNamedParameter<CNetServer*,
551  eNPT_ServerLastUsedPtr> TServerLastUsedPtr;
552 
553  /// Named parameter type to specify that the blob should not be read
554  /// if its age in seconds is greater than the specified value.
555  /// This type of parameter can be defined through the nc_max_age
556  /// macro substitution, for example:
557  /// nc_max_age = 3600
558  /// @see nc_max_age
560 
561  /// Named parameter type for a pointer to a variable where the actual
562  /// age of the blob is to be stored.
563  /// This type of parameter can be defined through the nc_actual_age
564  /// macro substitution, for example:
565  /// nc_actual_age = &blob_age
566  /// @see nc_actual_age
568 
569  /// Named parameter type to define whether to return NetCache
570  /// keys in CompoundID format.
571  /// This type of parameter can be defined through the
572  /// nc_use_compound_id macro substitution, for example:
573  /// nc_use_compound_id = true
574  /// @see nc_use_compound_id
576 
577  /// Named parameter type to define whether to run a request through all
578  /// NetCache servers in the ICache service in an attempt to find the blob.
579  /// This type of parameter can be defined through the
580  /// nc_try_all_servers macro substitution, for example:
581  /// nc_try_all_servers = true
582  /// @see nc_try_all_servers
584 
585  /// In ICache mode, override the name of the cache specified
586  /// in the CNetICacheClient constructor.
587  /// This type of parameter can be defined through the
588  /// nc_cache_name macro substitution, for example:
589  /// nc_cache_name = "appdata"
590  /// @see nc_cache_name
592 
593  /// @internal
594  CCompoundIDPool GetCompoundIDPool();
595  /// @internal
596  void SetCompoundIDPool(CCompoundIDPool::TInstance compound_id_pool);
597 };
598 
600 
601 extern NCBI_XCONNECT_EXPORT const char* const kNetCacheAPIDriverName;
602 
606 
607 
608 /// CBlobStorage_NetCache -- NetCache-based implementation of IBlobStorage
609 ///
611 {
612 public:
614 
615  /// Create Blob Storage
616  /// @param[in] nc_client
617  /// NetCache client - an instance of CNetCacheAPI.
619  m_NCClient(nc_client) {}
620 
621  virtual ~CBlobStorage_NetCache();
622 
623 
624  virtual bool IsKeyValid(const string& str);
625 
626  /// Get a blob content as a string
627  ///
628  /// @param[in] blob_key
629  /// Blob key to read
630  virtual string GetBlobAsString(const string& data_id);
631 
632  /// Get an input stream to a blob
633  ///
634  /// @param[in] blob_key
635  /// Blob key to read
636  /// @param[out] blob_size_ptr
637  /// if blob_size_ptr if not NULL the size of a blob is returned
638  /// @param[in] lock_mode
639  /// Blob locking mode
640  virtual CNcbiIstream& GetIStream(const string& data_id,
641  size_t* blob_size_ptr = 0,
642  ELockMode lock_mode = eLockWait);
643 
644  /// Get an output stream to a blob
645  ///
646  /// @param[in,out] blob_key
647  /// Blob key to read. If a blob with a given key does not exist
648  /// an key of a newly create blob will be assigned to blob_key
649  /// @param[in] lock_mode
650  /// Blob locking mode
651  virtual CNcbiOstream& CreateOStream(string& data_id,
652  ELockMode lock_mode = eLockNoWait);
653 
654  /// Create an new blob
655  ///
656  /// @return
657  /// Newly create blob key
658  virtual string CreateEmptyBlob();
659 
660  /// Delete a blob
661  ///
662  /// @param[in] blob_key
663  /// Blob key to read
664  virtual void DeleteBlob(const string& data_id);
665 
666  /// Close all streams and connections.
667  virtual void Reset();
668 
669  CNetCacheAPI GetNetCacheAPI() const {return m_NCClient;}
670 
671 private:
673 
674  unique_ptr<CNcbiIstream> m_IStream;
675  unique_ptr<CNcbiOstream> m_OStream;
676 
679 };
680 
681 /* @} */
682 
684 
685 #endif /* CONN___NETCACHE_API__HPP */
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...
Blob Storage interface.
A very basic data-read interface.
IRegistry –.
Definition: ncbireg.hpp:73
static const char * str(char *buf, int n)
Definition: stats.c:84
int offset
Definition: replacements.h:160
#define NULL
Definition: ncbistd.hpp:225
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.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
#define kEmptyStr
Definition: ncbistr.hpp:123
#define NCBI_XCONNECT_EXPORT
char * buf
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.
NetCache client specs.
#define NCBI_NET_COMPONENT(component)
NetSchedule client specs.
static pcre_uint8 * buffer
Definition: pcretest.c:1051
Plugin manager (using class factory paradigm).
Timeout structure.
Definition: ncbi_types.h:76
unique_ptr< CObjectIStream > GetIStream(string path, ESerialDataFormat serial_format)
Modified on Thu May 23 12:31:38 2024 by modify_doxy.py rev. 669887