NCBI C++ ToolKit
osg_connection.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: osg_connection.cpp 98588 2022-12-07 19:31:44Z vasilche $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Eugene Vasilchenko
27  *
28  * File Description: base class for processors which may generate os_gateway
29  * fetches
30  *
31  */
32 
33 #include <ncbi_pch.hpp>
34 
35 #include "osg_connection.hpp"
36 
37 #include <corelib/ncbithr.hpp>
45 #include <serial/serial.hpp>
46 #include <serial/iterator.hpp>
47 #include <util/thread_pool.hpp>
48 #include <cmath>
49 #include <corelib/ncbi_system.hpp>
51 #include "osg_processor_base.hpp"
52 #include "osg_mapper.hpp"
54 
55 
59 
60 
61 // Configuration parameters' names
62 static const char kConfigSection[] = "OSG_PROCESSOR";
63 static const char kParamServiceName[] = "service";
64 static const char kParamMaxConnectionCount[] = "maxconn";
65 static const char kParamDebugLevel[] = "debug";
66 static const char kParamExpirationTimeout[] = "expiration_timeout";
67 static const char kParamReadTimeout[] = "read_timeout";
68 static const char kParamCDDRetryTimeout[] = "cdd_retry_timeout";
69 static const char kParamRetryCount[] = "retry_count";
70 static const char kParamPreferredServer[] = "preferred_server";
71 static const char kParamPreference[] = "preference";
72 static const char kParamEnabledCDD[] = "enabled_cdd";
73 static const char kParamEnabledSNP[] = "enabled_snp";
74 static const char kParamEnabledWGS[] = "enabled_wgs";
75 static const char kParamAsyncProcessing[] = "async_processing";
76 static const char kParamWaitBeforeOSG[] = "wait_before_osg";
77 
78 // Default configuration parameters' values
79 static const char kDefaultServiceName[] = "ID2_SNP2";
80 static const int kMinMaxConnectionCount = 1;
81 static const int kDefaultMaxConnectionCount = 64;
83 static const double kMinExpirationTimeout = 1;
84 static const double kDefaultExpirationTimeout = 60;
85 //static const double kMinReadTimeout = .1;
86 static const double kDefaultReadTimeout = 30;
87 static const double kMinCDDRetryTimeout = .1;
88 static const double kDefaultCDDRetryTimeout = 0.9;
89 static const int kMinRetryCount = 1;
90 static const int kDefaultRetryCount = 3;
91 static const char kDefaultPreferredServer[] = "localhost";
92 static const int kDefaultPreference = 90;
93 static const bool kDefaultEnabledCDD = false;
94 static const bool kDefaultEnabledSNP = true;
95 static const bool kDefaultEnabledWGS = true;
100 static const bool kDefaultAsyncProcessing = true;
101 static const bool kDefaultWaitBeforeOSG = true;
102 
103 
104 static const int kNonResolutionTimeout = 5;
105 
106 
107 COSGConnection::COSGConnection(size_t connection_id)
108  : m_ConnectionID(connection_id),
109  m_RequestCount(0),
110  m_InitRequestWasSent(false),
111  m_Timestamp(CStopWatch::eStart)
112 {
113 }
114 
115 
116 COSGConnection::COSGConnection(size_t connection_id,
117  unique_ptr<CConn_IOStream>&& stream)
118  : m_ConnectionID(connection_id),
119  m_Stream(move(stream)),
120  m_RequestCount(0),
121  m_InitRequestWasSent(false),
122  m_Timestamp(CStopWatch::eStart)
123 {
124 }
125 
126 
128 {
129  if ( m_RemoveFrom ) {
131  }
133 }
134 
135 
137 {
138  return m_Timestamp.Restart();
139 }
140 
141 
143 {
144  if ( feedback != 0 && m_RemoveFrom && m_ServerInfo ) {
146  }
147 }
148 
149 
150 template<class Type>
152 {
153  SConditionalASNLogger(const Type& obj, bool condition)
154  : m_Object(obj), m_Condition(condition)
155  {
156  }
157 
158  const Type& m_Object;
160 };
161 template<class Type>
163 {
164  if ( logger.m_Condition ) {
165  out << MSerial_AsnText << logger.m_Object;
166  }
167  else {
168  out << Type::GetTypeInfo()->GetName();
169  }
170  return out;
171 }
172 template<class Type>
173 SConditionalASNLogger<Type> LogASNIf(const Type& obj, bool condition)
174 {
175  return SConditionalASNLogger<Type>(obj, condition);
176 }
177 
178 
179 const bool kSimulateFailures = false;
180 const int kNoFailureCount = 8;
181 const int kFailureRate = 8;
182 static DECLARE_TLS_VAR(int, s_NoFailureCount);
183 
184 static void s_SimulateFailure(const char* where)
185 {
186  if ( !kSimulateFailures ) {
187  return;
188  }
189  if ( s_NoFailureCount > 0 ) {
190  --s_NoFailureCount;
191  }
192  else if ( random() % kFailureRate == 0 ) {
193  s_NoFailureCount = kNoFailureCount;
194  string msg = string("simulated OSG ")+where+" failure";
195  if ( random() % 2 ) {
196  throw runtime_error(msg);
197  }
198  else {
199  NCBI_THROW(CIOException, eWrite, msg);
200  }
201  }
202 }
203 
204 
206 {
208  if ( GetDebugLevel() >= eDebug_exchange ) {
209  LOG_POST(GetDiagSeverity() << "OSG("<<GetConnectionID()<<"): "
210  "Sending "<<LogASNIf(packet, GetDebugLevel() >= eDebug_asn));
211  }
212  _ASSERT(!packet.Get().empty());
213  _ASSERT(packet.Get().front()->GetSerial_number()+int(packet.Get().size()) == GetNextRequestSerialNumber());
214  _ASSERT(packet.Get().back()->GetSerial_number()+1 == GetNextRequestSerialNumber());
215  s_SimulateFailure("send");
216  _ASSERT(m_InitRequestWasSent || packet.Get().front()->GetRequest().IsInit());
217  *m_Stream << MSerial_AsnBinary << packet;
218  if ( packet.Get().front()->GetRequest().IsInit() ) {
219  m_InitRequestWasSent = true;
220  }
222 }
223 
224 
226 {
227  s_SimulateFailure("read");
228  CRef<CID2_Reply> reply(new CID2_Reply());
229  *m_Stream >> MSerial_AsnBinary >> *reply;
231  if ( GetDebugLevel() >= eDebug_exchange ) {
232  if ( GetDebugLevel() >= eDebug_asn ) {
233  CTypeIterator<CID2_Reply_Data> iter = Begin(*reply);
234  if ( iter && iter->IsSetData() ) {
236  save.swap(iter->SetData());
237  size_t size = 0, count = 0;
238  ITERATE ( CID2_Reply_Data::TData, i, save ) {
239  ++count;
240  size_t chunk = (*i)->size();
241  size += chunk;
242  }
243  LOG_POST(GetDiagSeverity() << "OSG("<<GetConnectionID()<<"): "
244  "Received "<<MSerial_AsnText<<*reply<<
245  "Data: " << size << " bytes in "<<count<<" chunks");
246  save.swap(iter->SetData());
247  }
248  else {
249  LOG_POST(GetDiagSeverity() << "OSG("<<GetConnectionID()<<"): "
250  "Received "<<MSerial_AsnText<<*reply);
251  }
252  }
253  else {
254  LOG_POST(GetDiagSeverity() << "OSG("<<GetConnectionID()<<"): "
255  "Received "<<LogASNIf(*reply, GetDebugLevel() >= eDebug_raw));
256  }
257  }
258  return reply;
259 }
260 
261 
263 {
264  CRef<CID2_Request> req(new CID2_Request());
265  req->SetRequest().SetInit();
266  if ( 1 ) {
267  // set client name
268  CRef<CID2_Param> param(new CID2_Param);
269  param->SetName("log:client_name");
270  param->SetValue().push_back("pubseq_gateway");
271  req->SetParams().Set().push_back(param);
272  }
273  if ( 1 ) {
274  CRef<CID2_Param> param(new CID2_Param);
275  param->SetName("id2:allow");
276 
277  // allow new blob-state field in several ID2 replies
278  param->SetValue().push_back("*.blob-state");
279  // enable VDB-based WGS sequences
280  param->SetValue().push_back("vdb-wgs");
281  // enable VDB-based SNP sequences
282  param->SetValue().push_back("vdb-snp");
283  // enable VDB-based CDD sequences
284  param->SetValue().push_back("vdb-cdd");
285  req->SetParams().Set().push_back(param);
286  }
287  return req;
288 }
289 
290 
292 {
294  packet->Set().push_back(MakeInitRequest());
295  packet->Set().back()->SetSerial_number(AllocateRequestSerialNumber());
296  return packet;
297 }
298 
299 
301  : m_ServiceName(kDefaultServiceName),
302  m_MaxConnectionCount(kDefaultMaxConnectionCount),
303  m_ExpirationTimeout(kDefaultExpirationTimeout),
304  m_ReadTimeout(kDefaultReadTimeout),
305  m_CDDRetryTimeout(kDefaultCDDRetryTimeout),
306  m_RetryCount(kDefaultRetryCount),
307  m_DefaultEnabledFlags(kDefaultEnabledFlags),
308  m_WaitBeforeOSG(kDefaultWaitBeforeOSG),
309  m_AsyncProcessing(kDefaultAsyncProcessing),
310  m_WaitConnectionSlot(0, kMax_Int),
311  m_NextConnectionID(1),
312  m_ConnectionCount(0),
313  m_ConnectFailureCount(0)
314 {
315 }
316 
317 
319 {
320 }
321 
322 
324 {
325  // TODO
326 }
327 
328 
329 static Uint4 g_OSG_GetPreferredAddress(const string& name)
330 {
331  if (name.empty()) {
332  return 0;
333  } else if (NStr::EqualNocase(name, "localhost")) {
335  } else {
336  return CSocketAPI::gethostbyname(name);
337  }
338 }
339 
340 
342 {
343  if ( section.empty() ) {
344  section = kConfigSection;
345  }
346 
347 #define CHECK_PARAM_MIN(value, name, min_value) \
348  do { \
349  if ( value < min_value ) { \
350  NCBI_THROW_FMT(CPubseqGatewayException, eConfigurationError, \
351  name<<"(="<<value<<") < "<<min_value); \
352  } \
353  } while (0)
354 
355  m_ServiceName =
356  registry.GetString(section,
360  registry.GetInt(section,
364 
366 
368  registry.GetDouble(section,
372 
373  m_ReadTimeout =
374  registry.GetDouble(section,
377  //CHECK_PARAM_MIN(m_ReadTimeout, kParamReadTimeout, kMinReadTimeout);
378 
380  registry.GetDouble(section,
384 
385  m_RetryCount =
386  registry.GetInt(section,
390 
391 #undef CHECK_PARAM_MIN
392 
393  SetDebugLevel(registry.GetInt(section,
396  if ( GetDebugLevel() >= eDebug_open ) {
397  LOG_POST(GetDiagSeverity()<<"OSG: pool of "<<m_MaxConnectionCount<<
398  " connections to "<<m_ServiceName);
399  }
400 
402  CRef<COSGServiceMapper> service_mapper(new COSGServiceMapper(&registry));
403  string preferred_server = registry.GetString(section,
406  int preference = registry.GetInt(section,
409  auto psg_ip = g_OSG_GetPreferredAddress(preferred_server);
410  TSvrRef pref_info(new CDBServer(m_ServiceName, psg_ip));
411  service_mapper->SetPreference(m_ServiceName, pref_info, preference);
412  if ( GetDebugLevel() >= eDebug_open ) {
413  LOG_POST(GetDiagSeverity()<<"OSG: prefer "<<preferred_server<<
414  " ["<<CSocketAPI::ntoa(psg_ip)<<"] by "<<preference);
415  }
416  m_Mapper = service_mapper;
417 
418  TEnabledFlags enabled_flags = 0;
419  if ( registry.GetBool(section,
421  kDefaultEnabledWGS) ) {
422  enabled_flags |= CPSGS_OSGProcessorBase::fEnabledWGS;
423  }
424  if ( registry.GetBool(section,
426  kDefaultEnabledSNP) ) {
427  enabled_flags |= CPSGS_OSGProcessorBase::fEnabledSNP;
428  }
429  if ( registry.GetBool(section,
431  kDefaultEnabledCDD) ) {
432  enabled_flags |= CPSGS_OSGProcessorBase::fEnabledCDD;
433  }
434  m_DefaultEnabledFlags = enabled_flags;
435 
439 
440  m_WaitBeforeOSG = registry.GetBool(section,
443 
444  if ( 1 ) {
445  // pre-load CSeq_id accession type table
446  CSeq_id::IdentifyAccession("AAAA01000001");
447  }
448 
449  if ( GetDefaultEnabledFlags() ) {
450  // pre-open first OSG connection
451  try {
452  auto conn = AllocateConnection();
454  }
455  catch (exception& exc) {
456  ERR_POST(Warning<<"OSG: failed to open initial connection: "<<exc);
457  }
458  }
459 }
460 
461 
463 {
464  SetDiagSeverity(severity);
465 }
466 
467 
469 {
470  m_ThreadPool->AddTask(task);
471 }
472 
473 
475 {
477  while ( !conn ) {
478  {{
479  CMutexGuard guard(m_Mutex);
480  while ( !conn && !m_FreeConnections.empty() ) {
481  conn = move(m_FreeConnections.front());
482  m_FreeConnections.pop_front();
483  _ASSERT(!conn->m_RemoveFrom);
484  if ( conn->UpdateTimestamp() > m_ExpirationTimeout ) {
485  if ( GetDebugLevel() >= eDebug_open ) {
486  LOG_POST(GetDiagSeverity()<<"OSG("<<conn->GetConnectionID()<<"): "
487  "Closing expired connection");
488  }
490  conn = nullptr;
491  }
492  }
496  }
497  }}
498  if ( !conn ) {
500  }
501  }
503  _ASSERT(!conn->m_RemoveFrom);
504  conn->m_RemoveFrom = this;
505  if ( !conn->m_Stream ) {
506  try {
509  }
510  catch ( ... ) {
512  throw;
513  }
514  }
515  return conn;
516 }
517 
518 
520 {
521  _ASSERT(conn.m_RemoveFrom == this);
522  size_t connection_id = conn.GetConnectionID();
523  if ( GetDebugLevel() >= eDebug_open ) {
524  LOG_POST(GetDiagSeverity() << "OSG("<<connection_id<<"): "
525  "Connecting to "<<m_ServiceName);
526  }
527  int wait_count = m_ConnectFailureCount;
528  if ( wait_count > 0 ) {
529  // delay before opening new connection to a failing server
530  double wait_seconds = .5*pow(2., wait_count-1)+.5*wait_count;
531  wait_seconds = min(wait_seconds, 10.);
532  if ( GetDebugLevel() >= eDebug_open ) {
533  LOG_POST(GetDiagSeverity() << "OSG("<<connection_id<<"): waiting "<<
534  wait_seconds<<"s before new connection");
535  }
536  SleepMicroSec((unsigned long)(wait_seconds*1e6));
537  }
538  unique_ptr<CConn_IOStream> stream;
539  conn.m_ServiceName = m_ServiceName;
540  conn.m_ServerInfo = move(x_GetServer());
541  if ( conn.m_ServerInfo ) {
542  string host = CSocketAPI::ntoa(conn.m_ServerInfo->GetHost());
543  if ( GetDebugLevel() >= eDebug_open ) {
544  LOG_POST(GetDiagSeverity() << "OSG("<<connection_id<<"): "
545  "Connecting to "<<host<<":"<<conn.m_ServerInfo->GetPort());
546  }
547  stream = make_unique<CConn_SocketStream>(host, conn.m_ServerInfo->GetPort());
548  }
549  else {
550  stream = make_unique<CConn_ServiceStream>(m_ServiceName);
551  }
552  if ( !stream || !*stream ) {
553  NCBI_THROW(CIOException, eWrite, "failed to open connection");
554  }
555  if ( GetDebugLevel() >= eDebug_open ) {
556  string descr = m_ServiceName;
557  if ( CONN conn = stream->GetCONN() ) {
559  if ( conn_descr ) {
560  descr += " -> ";
561  descr += conn_descr.get();
562  }
563  }
564  LOG_POST(GetDiagSeverity() << "OSG("<<connection_id<<"): "
565  "Connected to "<<descr);
566  }
567  conn.m_Stream = move(stream);
568  if ( 1 ) {
569  auto req_packet = conn.MakeInitRequestPacket();
570  conn.SendRequestPacket(*req_packet);
571  _ASSERT(conn.InitRequestWasSent());
572  auto reply = conn.ReceiveReply();
573  if ( !reply->GetReply().IsInit() || !reply->IsSetEnd_of_reply() ) {
574  NCBI_THROW(CIOException, eRead, "bad init reply");
575  }
576  conn.AcceptFeedback(+1);
577  }
578  if ( m_ReadTimeout > 0 ) {
579  const int kMksScale = 1000000;
580  Int8 timeout_mks = Int8(round(m_ReadTimeout*kMksScale));
581  STimeout tmout;
582  tmout.sec = timeout_mks/kMksScale;
583  tmout.usec = timeout_mks%kMksScale;
584  conn.m_Stream->SetTimeout(eIO_ReadWrite, &tmout);
585  }
586 }
587 
588 
590 {
591  if ( !m_Mapper ) {
592  return null;
593  }
594  CMutexGuard guard(m_Mutex);
596  return null;
597  }
598  TSvrRef server;
599  do {
600  if ( !m_Balancer ) {
603  m_Balancer.Reset(new CPoolBalancer(m_ServiceName, options, true));
604  }
605  server = m_Balancer->GetServer();
606  if ( !server ) {
607  PSG_WARNING("Unable to resolve OSG service name "
608  << m_ServiceName
609  << " via supplied mapper; passing it as is.");
611  }
612  else if ( server->GetExpireTime() < CCurrentTime().GetTimeT() ) {
613  m_Balancer.Reset();
614  }
615  } while ( !m_Balancer );
616  if ( !server || server->GetHost() == 0 || server->GetPort() == 0 ) {
617  return null;
618  }
619  else {
620  return server;
621  }
622 }
623 
624 
626 {
627  CMutexGuard guard(m_Mutex);
628  _ASSERT(conn);
630  _ASSERT(conn->m_RemoveFrom == this);
631  conn->AcceptFeedback(+1);
632  conn->m_RemoveFrom = nullptr;
633  m_FreeConnections.push_back(move(conn));
634  _ASSERT(!conn);
636 }
637 
638 
640 {
641  if ( GetDebugLevel() >= eDebug_open ) {
642  LOG_POST(GetDiagSeverity()<<"OSG("<<conn.GetConnectionID()<<"): "
643  "Closing failed connection");
644  }
645  CMutexGuard guard(m_Mutex);
647  _ASSERT(conn.m_RemoveFrom == this);
648  conn.AcceptFeedback(-1);
649  conn.m_RemoveFrom = nullptr;
652 }
653 
654 
656 {
657  CMutexGuard guard(m_Mutex);
658  if ( feedback < 0 && m_Balancer ) {
659  m_Balancer->LocallyPenalize(server);
660  }
662  server->GetHost(), server->GetPort(),
663  (feedback < 0?
666 }
667 
668 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
T round(const T &v)
AutoPtr –.
Definition: ncbimisc.hpp:401
CArgs –.
Definition: ncbiargs.hpp:379
CCurrentTime –.
Definition: ncbitime.hpp:1283
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...
IDBServiceMapper.
time_t GetExpireTime(void) const
Uint2 GetPort(void) const
Uint4 GetHost(void) const
CDeadline.
Definition: ncbitime.hpp:1830
CID2_Param –.
Definition: ID2_Param.hpp:66
CID2_Reply –.
Definition: ID2_Reply.hpp:66
CID2_Request_Packet –.
CID2_Request –.
Definition: ID2_Request.hpp:66
CNcbiRegistry –.
Definition: ncbireg.hpp:913
void AppParseArgs(const CArgs &args)
list< CRef< COSGConnection > > m_FreeConnections
TEnabledFlags GetDefaultEnabledFlags() const
CRef< COSGServiceMapper > m_Mapper
void x_AcceptFeedback(TSvrRef server, int feedback)
void x_OpenConnection(COSGConnection &conn)
TEnabledFlags m_DefaultEnabledFlags
unique_ptr< CThreadPool > m_ThreadPool
friend class COSGConnection
void ReleaseConnection(CRef< COSGConnection > &conn)
CRef< CPoolBalancer > m_Balancer
void LoadConfig(const CNcbiRegistry &registry, string section=string())
void RemoveConnection(COSGConnection &conn)
void SetLogging(EDiagSev severity)
void Queue(CRef< CThreadPool_Task > task)
virtual ~COSGConnectionPool()
unique_ptr< CDeadline > m_NonresolutionRetryDeadline
CSemaphore m_WaitConnectionSlot
CRef< COSGConnection > AllocateConnection()
CRef< COSGConnectionPool > m_RemoveFrom
COSGConnection(size_t connection_id)
virtual ~COSGConnection()
size_t GetConnectionID() const
void AcceptFeedback(int feedback)
CRef< CID2_Reply > ReceiveReply()
static CRef< CID2_Request > MakeInitRequest()
void SendRequestPacket(const CID2_Request_Packet &packet)
unique_ptr< CConn_IOStream > m_Stream
int GetNextRequestSerialNumber() const
int AllocateRequestSerialNumber()
CRef< CID2_Request_Packet > MakeInitRequestPacket()
CStopWatch m_Timestamp
double UpdateTimestamp()
void LocallyPenalize(TSvrRef server)
TSvrRef GetServer(void)
CRef –.
Definition: ncbiobj.hpp:618
CStopWatch –.
Definition: ncbitime.hpp:1938
Main class implementing functionality of pool of threads.
Template class for iteration on objects of class C.
Definition: iterator.hpp:673
list< CRef< CDBServerOption > > TOptions
static CMemoryRegistry registry
Definition: cn3d_tools.cpp:81
std::ofstream out("events_result.xml")
main entry point for tests
static CS_CONNECTION * conn
Definition: ct_dynamic.c:25
#define false
Definition: bool.h:36
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
element_type * get(void) const
Get pointer.
Definition: ncbimisc.hpp:469
string
Definition: cgiapp.hpp:687
char * CONN_Description(CONN conn)
Return a human-readable description of the connection as a character '\0'-terminated string.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
EDiagSev
Severity level for the posted diagnostics.
Definition: ncbidiag.hpp:650
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
#define MSerial_AsnBinary
Definition: serialbase.hpp:697
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:696
static EAccessionInfo IdentifyAccession(const CTempString &accession, TParseFlags flags=fParse_AnyRaw)
Deduces information from a bare accession a la WHICH_db_accession; may report false negatives on prop...
Definition: Seq_id.cpp:1634
void GetServerOptions(const string &service, TOptions *options)
Get an annotated list of all servers for the given service.
Definition: osg_mapper.cpp:366
void AcceptFeedback(const string &service, unsigned int host, unsigned short port, EFeedback feedback)
Definition: osg_mapper.cpp:413
static void InitDefaults(IRWRegistry &reg)
Definition: osg_mapper.cpp:68
CBeginInfo Begin(C &obj)
Get starting point of object hierarchy.
Definition: iterator.hpp:1004
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define kMax_Int
Definition: ncbi_limits.h:184
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
#define kMax_UInt
Definition: ncbi_limits.h:185
virtual bool GetBool(const string &section, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get boolean value of specified parameter name.
Definition: ncbireg.cpp:391
virtual int GetInt(const string &section, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get integer value of specified parameter name.
Definition: ncbireg.cpp:362
virtual double GetDouble(const string &section, const string &name, double default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get double value of specified parameter name.
Definition: ncbireg.cpp:420
virtual string GetString(const string &section, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
Definition: ncbireg.cpp:321
static string ntoa(unsigned int host)
BSD-like API. NB: when int, "host" must be in network byte order.
static unsigned int gethostbyname(const string &host, ESwitch log=eOff)
Return 0 on error.
static unsigned int GetLocalHostAddress(ESwitch reget=eDefault)
Local host address in network byte order (cached for faster retrieval)
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
void Wait(void)
Wait on semaphore.
Definition: ncbimtx.cpp:1787
void Post(unsigned int count=1)
Increment the semaphore by "count".
Definition: ncbimtx.cpp:1971
double Restart(void)
Return time elapsed since first Start() or last Restart() call (in seconds).
Definition: ncbitime.hpp:2817
unsigned int usec
microseconds (modulo 1,000,000)
Definition: ncbi_types.h:78
unsigned int sec
seconds
Definition: ncbi_types.h:77
@ eIO_ReadWrite
eIO_Read | eIO_Write (also, eCONN_OnFlush)
Definition: ncbi_core.h:122
void SetParams(TParams &value)
Assign a value to Params data member.
list< vector< char > * > TData
Tdata & Set(void)
Assign a value to data member.
void SetRequest(TRequest &value)
Assign a value to Request data member.
const Tdata & Get(void) const
Get the member data.
int i
const struct ncbi::grid::netcache::search::fields::SIZE size
void SleepMicroSec(unsigned long mc_sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Multi-threading – classes, functions, and features.
T min(T x_, T y_)
@ eRead
Definition: ns_types.hpp:56
static const char kParamEnabledWGS[]
static DECLARE_TLS_VAR(int, s_NoFailureCount)
static const char kParamMaxConnectionCount[]
static const double kDefaultReadTimeout
static const int kMinMaxConnectionCount
static const EDebugLevel kDefaultDebugLevel
static const double kMinExpirationTimeout
const bool kSimulateFailures
static const bool kDefaultEnabledCDD
static const bool kDefaultWaitBeforeOSG
static const char kParamServiceName[]
static const char kParamPreference[]
static const bool kDefaultAsyncProcessing
static const char kParamExpirationTimeout[]
#define CHECK_PARAM_MIN(value, name, min_value)
static const int kNonResolutionTimeout
static const char kParamEnabledCDD[]
static const double kMinCDDRetryTimeout
static const COSGConnectionPool::TEnabledFlags kDefaultEnabledFlags
static const char kDefaultServiceName[]
const int kNoFailureCount
static const char kParamCDDRetryTimeout[]
static const double kDefaultCDDRetryTimeout
static const char kParamPreferredServer[]
static const int kDefaultMaxConnectionCount
const int kFailureRate
static void s_SimulateFailure(const char *where)
static const char kParamRetryCount[]
END_NCBI_NAMESPACE
static const double kDefaultExpirationTimeout
static const int kDefaultRetryCount
static const char kParamWaitBeforeOSG[]
CNcbiOstream & operator<<(CNcbiOstream &out, const SConditionalASNLogger< Type > &logger)
static Uint4 g_OSG_GetPreferredAddress(const string &name)
BEGIN_NCBI_NAMESPACE
static const char kParamDebugLevel[]
static const char kParamReadTimeout[]
static const char kParamEnabledSNP[]
BEGIN_NAMESPACE(psg)
static const char kParamAsyncProcessing[]
static const bool kDefaultEnabledSNP
static const char kDefaultPreferredServer[]
static const char kConfigSection[]
static const int kMinRetryCount
static const bool kDefaultEnabledWGS
SConditionalASNLogger< Type > LogASNIf(const Type &obj, bool condition)
static const int kDefaultPreference
END_NAMESPACE(osg)
void SetDiagSeverity(EDiagSev severity)
void SetDebugLevel(int level)
Severity GetDiagSeverity()
int GetDebugLevel()
@ eDebug_raw
@ eDebug_open
@ eDebugLevel_default
@ eDebug_asn
@ eDebug_exchange
@ eDebug_error
#define PSG_WARNING(message)
SConditionalASNLogger(const Type &obj, bool condition)
Timeout structure.
Definition: ncbi_types.h:76
#define _ASSERT
#define Type
Pool of generic task-executing threads.
Modified on Sun Apr 14 05:27:42 2024 by modify_doxy.py rev. 669887