NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
CNetService Class Reference

Search Toolkit Book for CNetService

#include <connect/services/netservice_api.hpp>

+ Collaboration diagram for CNetService:

Public Types

enum  EIterationMode { eSortByLoad , eRandomize , eRoundRobin , eIncludePenalized }
 
enum  ECmdOutputStyle {
  eSingleLineOutput , eUrlEncodedOutput , eMultilineOutput , eMultilineOutput_NoHeaders ,
  eMultilineOutput_NetCacheStyle
}
 
typedef SNetServiceImplTInstance
 
using TEventHandler = function< bool(const string &, CNetServer)>
 

Public Member Functions

 CNetService (EVoid)
 
 CNetService (SNetServiceImpl *impl)
 
CNetServiceoperator= (SNetServiceImpl *impl)
 
 operator SNetServiceImpl * ()
 
 operator const SNetServiceImpl * () const
 
SNetServiceImploperator-- (int)
 
const SNetServiceImploperator-- (int) const
 
SNetServiceImploperator-> ()
 
const SNetServiceImploperator-> () const
 
 CNetService ()
 
const stringGetServiceName () const
 
CNetServerPool GetServerPool ()
 
CNetServer GetServer (unsigned host, unsigned short port)
 
CNetServer GetServer (const string &host, unsigned short port)
 
CNetServiceIterator Iterate (EIterationMode mode=eSortByLoad)
 
CNetServiceIterator Iterate (CNetServer::TInstance priority_server)
 
CNetServiceIterator IterateByWeight (const string &key)
 
CNetServiceIterator ExcludeServer (CNetServer::TInstance server)
 Start iteration excluding 'server' (return the next server after 'server' or NULL). More...
 
CNetServiceIterator FindServer (INetServerFinder *finder, EIterationMode mode=eSortByLoad)
 
bool IsLoadBalanced () const
 
CNetServer::SExecResult FindServerAndExec (const string &cmd, bool multiline_output=false)
 
void ExecOnAllServers (const string &cmd)
 
void PrintCmdOutput (const string &cmd, CNcbiOstream &output_stream, ECmdOutputStyle output_style, CNetService::EIterationMode=CNetService::eSortByLoad)
 
CNetService Clone (const string &name)
 
void SetErrorHandler (TEventHandler error_handler)
 
void SetWarningHandler (TEventHandler warning_handler)
 

Static Public Member Functions

static void AllowXSiteConnections ()
 
static bool IsUsingXSiteProxy ()
 
static CNetService Create (const string &api_name, const string &service_name, const string &client_name)
 

Protected Attributes

CNetRef< SNetServiceImplm_Impl
 

Detailed Description

Definition at line 85 of file netservice_api.hpp.

Member Typedef Documentation

◆ TEventHandler

Definition at line 136 of file netservice_api.hpp.

◆ TInstance

Definition at line 87 of file netservice_api.hpp.

Member Enumeration Documentation

◆ ECmdOutputStyle

Enumerator
eSingleLineOutput 
eUrlEncodedOutput 
eMultilineOutput 
eMultilineOutput_NoHeaders 
eMultilineOutput_NetCacheStyle 

Definition at line 121 of file netservice_api.hpp.

◆ EIterationMode

Enumerator
eSortByLoad 
eRandomize 
eRoundRobin 
eIncludePenalized 

Definition at line 93 of file netservice_api.hpp.

Constructor & Destructor Documentation

◆ CNetService() [1/3]

CNetService::CNetService ( EVoid  )
inline

Definition at line 87 of file netservice_api.hpp.

◆ CNetService() [2/3]

CNetService::CNetService ( SNetServiceImpl impl)
inline

Definition at line 87 of file netservice_api.hpp.

◆ CNetService() [3/3]

CNetService::CNetService ( )
inline

Definition at line 87 of file netservice_api.hpp.

Member Function Documentation

◆ AllowXSiteConnections()

static void CNetService::AllowXSiteConnections ( )
static

◆ Clone()

CNetService CNetService::Clone ( const string name)

Definition at line 1378 of file netservice_api.cpp.

References _ASSERT, SNetServiceImpl::Clone(), and m_Impl.

Referenced by Create(), and SNetStorageRPC::GetServiceIfLocator().

◆ Create()

CNetService CNetService::Create ( const string api_name,
const string service_name,
const string client_name 
)
static

◆ ExcludeServer()

CNetServiceIterator CNetService::ExcludeServer ( CNetServer::TInstance  server)

Start iteration excluding 'server' (return the next server after 'server' or NULL).

Definition at line 1316 of file netservice_api.cpp.

References ITERATE, m_Impl, SNetServerImpl::m_ServerInPool, SDiscoveredServers::m_Servers, and NULL.

Referenced by CCgi2RCgiApp::GetStatus().

◆ ExecOnAllServers()

void CNetService::ExecOnAllServers ( const string cmd)

◆ FindServer()

CNetServiceIterator CNetService::FindServer ( INetServerFinder finder,
CNetService::EIterationMode  mode = eSortByLoad 
)

◆ FindServerAndExec()

CNetServer::SExecResult CNetService::FindServerAndExec ( const string cmd,
bool  multiline_output = false 
)

◆ GetServer() [1/2]

CNetServer CNetService::GetServer ( const string host,
unsigned short  port 
)

Definition at line 838 of file netservice_api.cpp.

References m_Impl.

◆ GetServer() [2/2]

CNetServer CNetService::GetServer ( unsigned  host,
unsigned short  port 
)

Definition at line 844 of file netservice_api.cpp.

References m_Impl.

Referenced by SNetCacheAPIImpl::ExecMirrorAware(), and CCgi2RCgiApp::GetStatus().

◆ GetServerPool()

CNetServerPool CNetService::GetServerPool ( )

◆ GetServiceName()

const string & CNetService::GetServiceName ( ) const

◆ IsLoadBalanced()

bool CNetService::IsLoadBalanced ( ) const

◆ IsUsingXSiteProxy()

static bool CNetService::IsUsingXSiteProxy ( )
static

◆ Iterate() [1/2]

CNetServiceIterator CNetService::Iterate ( CNetServer::TInstance  priority_server)

Definition at line 1272 of file netservice_api.cpp.

References m_Impl.

◆ Iterate() [2/2]

◆ IterateByWeight()

CNetServiceIterator CNetService::IterateByWeight ( const string key)

◆ operator const SNetServiceImpl *()

CNetService::operator const SNetServiceImpl * ( ) const
inline

Definition at line 87 of file netservice_api.hpp.

◆ operator SNetServiceImpl *()

CNetService::operator SNetServiceImpl * ( )
inline

Definition at line 87 of file netservice_api.hpp.

◆ operator--() [1/2]

SNetServiceImpl& CNetService::operator-- ( int  )
inline

Definition at line 87 of file netservice_api.hpp.

◆ operator--() [2/2]

const SNetServiceImpl& CNetService::operator-- ( int  ) const
inline

Definition at line 87 of file netservice_api.hpp.

◆ operator->() [1/2]

SNetServiceImpl* CNetService::operator-> ( void  )
inline

Definition at line 87 of file netservice_api.hpp.

◆ operator->() [2/2]

const SNetServiceImpl* CNetService::operator-> ( void  ) const
inline

Definition at line 87 of file netservice_api.hpp.

◆ operator=()

CNetService& CNetService::operator= ( SNetServiceImpl impl)
inline

Definition at line 87 of file netservice_api.hpp.

◆ PrintCmdOutput()

void CNetService::PrintCmdOutput ( const string cmd,
CNcbiOstream output_stream,
CNetService::ECmdOutputStyle  output_style,
CNetService::EIterationMode  iteration_mode = CNetService::eSortByLoad 
)

◆ SetErrorHandler()

void CNetService::SetErrorHandler ( TEventHandler  error_handler)

Definition at line 1385 of file netservice_api.cpp.

References m_Impl.

◆ SetWarningHandler()

void CNetService::SetWarningHandler ( TEventHandler  warning_handler)

Member Data Documentation

◆ m_Impl

CNetRef< SNetServiceImpl > CNetService::m_Impl
protected

The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:19 2024 by modify_doxy.py rev. 669887