1 #ifndef CONNECT_SERVICES__NETSTORAGE_RPC__HPP 2 #define CONNECT_SERVICES__NETSTORAGE_RPC__HPP 3 4 /* $Id: netstorage_rpc.hpp 590486 2019-07-30 15:47:21Z 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 * Author: Dmitry Kazimirov 30 * 31 * File Description: 32 * Declarations for the NetStorage client API implementation. 33 * 34 */ 35 36 #include "netservice_api_impl.hpp" 37 38 #include <connect/services/netcache_api.hpp> 39 #include <connect/services/impl/netstorage_impl.hpp> 40 41 BEGIN_NCBI_SCOPE 42 43 struct SNetStorageRPC : public SNetStorageImpl 44 { 45 SNetStorageRPC(const TConfig& config, TNetStorageFlags default_flags); 46 SNetStorageRPC(SNetServerInPool* server, SNetStorageRPC* parent); 47 48 SNetStorageObjectImpl* Create(TNetStorageFlags flags) override; 49 SNetStorageObjectImpl* Open(const string& object_loc) override; 50 51 CJsonNode Exchange(CNetService service, 52 const CJsonNode& request, 53 CNetServerConnection* conn = NULL, 54 CNetServer::TInstance server_to_use = NULL) const; 55 56 CJsonNode MkStdRequest(const string& request_type) const; 57 CJsonNode MkObjectRequest(const string& request_type, 58 const string& object_loc) const; 59 CJsonNode MkObjectRequest(const string& request_type, 60 const string& unique_key, TNetStorageFlags flags) const; 61 EVoid x_InitNetCacheAPI(); 62 63 CNetService GetServiceIfLocator(const string& object_loc); 64 GetFlagsSNetStorageRPC65 TNetStorageFlags GetFlags(TNetStorageFlags flags) const 66 { 67 return flags ? flags : m_DefaultFlags; 68 } 69 70 private: 71 TNetStorageFlags m_DefaultFlags; 72 73 public: 74 CNetService m_Service; 75 76 const TConfig m_Config; 77 78 mutable CAtomicCounter m_RequestNumber; 79 80 CCompoundIDPool m_CompoundIDPool; 81 82 CNetCacheAPI m_NetCacheAPI; 83 84 private: 85 map<string, CNetService> m_ServiceMap; 86 }; 87 88 END_NCBI_SCOPE 89 90 #endif /* CONNECT_SERVICES__NETSTORAGE_RPC__HPP */ 91