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

Search Toolkit Book for CDBLB_ServiceMapper

CDBLBServerNamePolicy. More...

#include <connect/ext/ncbi_dblb_svcmapper.hpp>

+ Inheritance diagram for CDBLB_ServiceMapper:
+ Collaboration diagram for CDBLB_ServiceMapper:

Public Member Functions

 CDBLB_ServiceMapper (const IRegistry *registry=NULL)
 
virtual ~CDBLB_ServiceMapper (void)
 
virtual string GetName (void) const
 
virtual void Configure (const IRegistry *registry=NULL)
 
virtual TSvrRef GetServer (const string &service)
 Map a service to a server. More...
 
virtual void GetServersList (const string &service, list< string > *serv_list) const
 Get list of all servers for the given service disregarding any exclusions. More...
 
virtual void GetServerOptions (const string &service, TOptions *options)
 Get an annotated list of all servers for the given service. More...
 
virtual void SetPreference (const string &service, const TSvrRef &preferred_server, double preference=100.0)
 Set up mapping preferences for a service preference - value between 0 and 100 (0 means *no particular preferances*, 100 means *do not choose, just use a given server*) preferred_server - preferred server. More...
 
virtual bool RecordServer (I_ConnectionExtra &extra) const
 Given a connection that succeeded even though this service mapper was unable to identify a good server beforehand, try to determine which server it actually reached on the basis of its low-level handle (if available); on success, pass the result to its x_RecordServer method to inform subsequent logging. More...
 
- Public Member Functions inherited from IDBServiceMapper
virtual ~IDBServiceMapper (void)
 
virtual void Exclude (const string &service, const TSvrRef &server)
 Exclude a server from the mapping for a service. More...
 
virtual void CleanExcluded (const string &service)
 Clean the list of excluded servers for the given service. More...
 
virtual bool HasExclusions (const string &service) const
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Static Public Member Functions

static IDBServiceMapperFactory (const IRegistry *registry)
 
- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 

Protected Member Functions

void ConfigureFromRegistry (const IRegistry *registry=NULL)
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 
- Protected Member Functions inherited from CConnIniter
 CConnIniter (void)
 

Private Types

typedef map< string, pair< TSERV_Type, time_t > > TLBEmptyMap
 
typedef map< string, pair< double, TSvrRef > > TPreferenceMap
 

Private Member Functions

TSvrRef x_GetServer (const string &service)
 
bool x_IsEmpty (const string &service, TSERV_Type promiscuity, time_t now)
 

Private Attributes

TLBEmptyMap m_LBEmptyMap
 
TPreferenceMap m_PreferenceMap
 
int m_EmptyTTL
 

Additional Inherited Members

- Public Types inherited from IDBServiceMapper
typedef IDBServiceMapper *(* TFactory) (const IRegistry *registry)
 
typedef list< CRef< CDBServerOption > > TOptions
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 
- Protected Types inherited from IDBServiceMapper
typedef set< TSvrRef, SDereferenceLessTSrvSet
 
typedef map< string, TSrvSetTExcludeMap
 
- Static Protected Member Functions inherited from IDBServiceMapper
static void x_RecordServer (I_ConnectionExtra &extra, CDBServer &server)
 
- Protected Attributes inherited from IDBServiceMapper
CFastMutex m_Mtx
 
TExcludeMap m_ExcludeMap
 

Detailed Description

CDBLBServerNamePolicy.

Definition at line 51 of file ncbi_dblb_svcmapper.hpp.

Member Typedef Documentation

◆ TLBEmptyMap

typedef map<string, pair<TSERV_Type,time_t> > CDBLB_ServiceMapper::TLBEmptyMap
private

Definition at line 78 of file ncbi_dblb_svcmapper.hpp.

◆ TPreferenceMap

typedef map<string, pair<double, TSvrRef> > CDBLB_ServiceMapper::TPreferenceMap
private

Definition at line 79 of file ncbi_dblb_svcmapper.hpp.

Constructor & Destructor Documentation

◆ CDBLB_ServiceMapper()

CDBLB_ServiceMapper::CDBLB_ServiceMapper ( const IRegistry registry = NULL)

Definition at line 71 of file ncbi_dblb_svcmapper.cpp.

References ConfigureFromRegistry(), and registry.

Referenced by Factory().

◆ ~CDBLB_ServiceMapper()

CDBLB_ServiceMapper::~CDBLB_ServiceMapper ( void  )
virtual

Definition at line 77 of file ncbi_dblb_svcmapper.cpp.

Member Function Documentation

◆ Configure()

void CDBLB_ServiceMapper::Configure ( const IRegistry registry = NULL)
virtual

Implements IDBServiceMapper.

Definition at line 89 of file ncbi_dblb_svcmapper.cpp.

References ConfigureFromRegistry(), IDBServiceMapper::m_Mtx, and registry.

◆ ConfigureFromRegistry()

void CDBLB_ServiceMapper::ConfigureFromRegistry ( const IRegistry registry = NULL)
protected

◆ Factory()

IDBServiceMapper * CDBLB_ServiceMapper::Factory ( const IRegistry registry)
static

Definition at line 490 of file ncbi_dblb_svcmapper.cpp.

References CDBLB_ServiceMapper(), and registry.

Referenced by MakeCDBUniversalMapper().

◆ GetName()

string CDBLB_ServiceMapper::GetName ( void  ) const
virtual

Reimplemented from IDBServiceMapper.

Definition at line 82 of file ncbi_dblb_svcmapper.cpp.

References CDBServiceMapperTraits< T >::GetName().

◆ GetServer()

TSvrRef CDBLB_ServiceMapper::GetServer ( const string service)
virtual

Map a service to a server.

Implements IDBServiceMapper.

Definition at line 167 of file ncbi_dblb_svcmapper.cpp.

References IDBServiceMapper::m_Mtx, and x_GetServer().

Referenced by init_common().

◆ GetServerOptions()

void CDBLB_ServiceMapper::GetServerOptions ( const string service,
TOptions options 
)
virtual

◆ GetServersList()

void CDBLB_ServiceMapper::GetServersList ( const string ,
list< string > *  serv_list 
) const
virtual

◆ RecordServer()

bool CDBLB_ServiceMapper::RecordServer ( I_ConnectionExtra ) const
virtual

Given a connection that succeeded even though this service mapper was unable to identify a good server beforehand, try to determine which server it actually reached on the basis of its low-level handle (if available); on success, pass the result to its x_RecordServer method to inform subsequent logging.

Returns
true if successful, false otherwise.

Reimplemented from IDBServiceMapper.

Definition at line 452 of file ncbi_dblb_svcmapper.cpp.

References eNH_HostByteOrder, eNH_NetworkByteOrder, fSOCK_KeepOnClose, I_ConnectionExtra::GetLowLevelHandle(), CSocketAPI::HostPortToString(), NULL, SOCK_Close(), SOCK_CreateOnTopEx(), SOCK_GetPeerAddress(), SOCK_GetRemotePort(), and IDBServiceMapper::x_RecordServer().

◆ SetPreference()

void CDBLB_ServiceMapper::SetPreference ( const string service,
const TSvrRef preferred_server,
double  preference = 100.0 
)
virtual

Set up mapping preferences for a service preference - value between 0 and 100 (0 means *no particular preferances*, 100 means *do not choose, just use a given server*) preferred_server - preferred server.

Implements IDBServiceMapper.

Definition at line 442 of file ncbi_dblb_svcmapper.cpp.

References IDBServiceMapper::m_Mtx, and m_PreferenceMap.

Referenced by ConfigureFromRegistry().

◆ x_GetServer()

TSvrRef CDBLB_ServiceMapper::x_GetServer ( const string service)
private

◆ x_IsEmpty()

bool CDBLB_ServiceMapper::x_IsEmpty ( const string service,
TSERV_Type  promiscuity,
time_t  now 
)
private

Member Data Documentation

◆ m_EmptyTTL

int CDBLB_ServiceMapper::m_EmptyTTL
private

Definition at line 83 of file ncbi_dblb_svcmapper.hpp.

Referenced by ConfigureFromRegistry(), GetServerOptions(), and x_GetServer().

◆ m_LBEmptyMap

TLBEmptyMap CDBLB_ServiceMapper::m_LBEmptyMap
private

Definition at line 81 of file ncbi_dblb_svcmapper.hpp.

Referenced by GetServerOptions(), x_GetServer(), and x_IsEmpty().

◆ m_PreferenceMap

TPreferenceMap CDBLB_ServiceMapper::m_PreferenceMap
private

Definition at line 82 of file ncbi_dblb_svcmapper.hpp.

Referenced by GetServerOptions(), SetPreference(), and x_GetServer().


The documentation for this class was generated from the following files:
Modified on Wed Sep 04 15:04:39 2024 by modify_doxy.py rev. 669887