NCBI C++ Toolkit Cross Reference

  C++/include/connect/services/netcache_api.hpp


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

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.