1 #ifndef CONNECT_SERVICES___SRV_CONNECTIONS_IMPL__HPP
2 #define CONNECT_SERVICES___SRV_CONNECTIONS_IMPL__HPP
89 void OnError(
const string& err_msg,
CNetServer& server);
90 void OnWarning(
const string& warn_msg,
CNetServer& server);
117 bool multiline_output);
147 const string&
cmd) = 0;
265 bool multiline_output,
266 bool retry_on_exception =
false);
269 bool multiline_output,
277 template <
class TProperties>
function< bool(const string &, CNetServer)> TEventHandler
CTimeoutKeeper(CSocket *sock, const STimeout *timeout)
virtual void Exec(CNetServerConnection::TInstance conn_impl, const STimeout *timeout)=0
virtual ~INetServerExecHandler()
virtual void OnExec(CNetServerConnection::TInstance conn_impl, const string &cmd)=0
virtual ~INetServerExecListener()
container_type::const_iterator const_iterator
void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler
static CS_CONNECTION * conn
static SQLCHAR output[256]
TNCBIAtomicValue TValue
Alias TValue for TNCBIAtomicValue.
CObject & operator=(const CObject &src) THROWS_NONE
Assignment operator.
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
const STimeout * GetTimeout(EIO_Event event) const
Get timeout for I/O in the specified direction.
EIO_Status SetTimeout(EIO_Event event, const STimeout *timeout)
Set timeout for I/O in the specified direction.
@ eIO_ReadWrite
eIO_Read | eIO_Write (also, eCONN_OnFlush)
#define NCBI_XCONNECT_EXPORT
Multi-threading – mutexes; rw-locks; semaphore.
function< INetServerProperties *()> TPropCreator
virtual void OnErrorImpl(const string &err_msg, CNetServer &server)=0
virtual INetServerConnectionListener * Clone()=0
CNetService::TEventHandler TEventHandler
virtual void OnConnected(CNetServerConnection &connection)=0
virtual void OnWarningImpl(const string &warn_msg, CNetServer &server)=0
TEventHandler m_WarningHandler
INetServerConnectionListener()=default
TEventHandler m_ErrorHandler
SNetServerConnectionImpl(SNetServerImpl *pool)
virtual ~SNetServerConnectionImpl()
SNetServerConnectionImpl * m_NextFree
CAtomicCounter::TValue m_Generation
void ReadCmdOutputLine(string &result, bool multiline_output)
void WriteLine(const string &line)
virtual void DeleteThis()
Virtual method "deleting" this object.
CRef< SNetServerInPool > m_ServerInPool
static void ConnectImpl(CSocket &, SConnectDeadline &, const SSocketAddress &, const SSocketAddress &)
SNetServerImpl(CNetService::TInstance service, SNetServerInPool *server_in_pool)
CRef< TProperties > Get()
void TryExec(INetServerExecHandler &handler, const STimeout *timeout=NULL)
CNetServer::SExecResult ConnectAndExec(const string &cmd, bool multiline_output, bool retry_on_exception=false)
SNetServerInPool(SSocketAddress address, INetServerProperties *server_properties, SThrottleParams throttle_params)
SThrottleStats m_ThrottleStats
virtual ~SNetServerInPool()
CRef< INetServerProperties > m_ServerProperties
int m_FreeConnectionListSize
void TryExec(SNetServerImpl *server, INetServerExecHandler &handler, const STimeout *timeout)
SNetServerConnectionImpl * m_FreeConnectionListHead
CNetServerPool m_ServerPool
virtual void DeleteThis()
Virtual method "deleting" this object.
CNetServerConnection GetConnectionFromPool(SNetServerImpl *server)
CAtomicCounter m_CurrentConnectionGeneration
CFastMutex m_FreeConnectionListLock
CNetServerConnection Connect(SNetServerImpl *server, const STimeout *timeout)
bool GetNextAttribute(string &attr_name, string &attr_value)
SNetServerInfoImpl(const string &version_string)
CUrlArgs::TArgs TAttributes
TAttributes::const_iterator m_NextAttribute
virtual ~SNetServerMultilineCmdOutputImpl()
void SetNetCacheCompatMode()
SNetServerMultilineCmdOutputImpl(const CNetServer::SExecResult &exec_result)
bool m_NetCacheCompatMode
CNetServerConnection m_Connection
bool ReadLine(string &output)
void Init(CSynRegistry ®istry, const SRegSynonyms §ions)
constexpr static size_t kMaxDenominator
int max_consecutive_io_failures
bool throttle_until_discoverable
struct SThrottleParams::SIOFailureThreshold io_failure_threshold
bool connect_failures_only
void Init(CSynRegistry ®istry, const SRegSynonyms §ions)
void Check(SNetServerImpl *server_impl)
bool m_DiscoveredAfterThrottling
CFastMutex m_ThrottleLock
const SThrottleParams m_Params
void Adjust(SNetServerImpl *server_impl, int err_code)
pair< bitset< SThrottleParams::SIOFailureThreshold::kMaxDenominator >, size_t > m_IOFailureRegister
SThrottleStats(SThrottleParams params)
int m_NumberOfConsecutiveIOFailures