A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/z__end__points_8cpp_source.html below:

NCBI C++ ToolKit: src/app/pubseq_gateway/server/z_end_points.cpp Source File

55  const string

& description) :

72  "Check of data retrieval from Cassandra DB"

),

74  "Check of data retrieval from LMDB"

),

76  "Check of data retrieval from WGS"

),

78  "Check of data retrieval from CDD"

),

80  "Check of data retrieval from SNP"

),

82  "Check that the number of client connections is within the soft limit"

)

88  if

(

check

.Id ==

id

) {

94  "Cannot find a description of the check '"

+

id

+

"'"

);

101  if

(

check

.Id ==

"cassandra"

) {

106  if

(

check

.Id ==

"lmdb"

) {

111  if

(

check

.Id ==

"wgs"

) {

116  if

(

check

.Id ==

"cdd"

) {

121  if

(

check

.Id ==

"snp"

) {

126  if

(

check

.Id ==

"connections"

) {

127  check

.HealthCommand =

""

;

134

TPSG_Https::SetDefault(

true

);

146

shared_ptr<CPSGS_Reply> reply)

155

shared_ptr<CPSGS_Reply> reply)

164

shared_ptr<CPSGS_Reply> reply)

173

shared_ptr<CPSGS_Reply> reply)

182

shared_ptr<CPSGS_Reply> reply)

184  auto

now = psg_clock_t::now();

199

reply->GetBytesSent());

205

reply->GetBytesSent());

210

vector<string> exclude_checks;

218  size_t

critical_check_count = 0;

219  size_t

non_critical_check_count = 0;

220  bool

is_critical =

false

;

229

exclude_checks, is_critical)) {

235  check

.HealthCommandTimeout,

239

++critical_check_count;

240

final_critical_http_status =

max

(final_critical_http_status,

243

++non_critical_check_count;

244

final_non_critical_http_status =

max

(final_non_critical_http_status,

249

checks_node.

Append

(check_node);

256  if

((critical_check_count + non_critical_check_count) == 0) {

259

final_json_node.

SetString

(

"message"

,

"All checks were skipped"

);

263  if

(critical_check_count > 0) {

264

final_http_status = final_critical_http_status;

266

final_http_status = final_non_critical_http_status;

271

final_json_node.

SetByKey

(

"checks"

, checks_node);

276

reply->SetContentLength(content.size());

280

reply->SetContentLength(0);

285

final_http_status, reply->GetBytesSent());

292  const

vector<string> & exclude_checks,

298  if

(find(exclude_checks.begin(),

299

exclude_checks.end(),

323

shared_ptr<CPSGS_Reply> reply)

333

shared_ptr<CPSGS_Reply> reply)

343

shared_ptr<CPSGS_Reply> reply)

353

shared_ptr<CPSGS_Reply> reply)

363

shared_ptr<CPSGS_Reply> reply)

373

shared_ptr<CPSGS_Reply> reply)

384

shared_ptr<CPSGS_Reply> reply,

385  const string

& check_id)

387  auto

now = psg_clock_t::now();

402

reply->GetBytesSent());

405  if

(check_id !=

"connections"

) {

409

reply->GetBytesSent());

425

check_node.

SetString

(

"id"

, check_id);

426

check_node.

SetString

(

"name"

,

"unknown"

);

427

check_node.

SetString

(

"description"

,

"unknown"

);

428

check_node.

SetString

(

"status"

,

"fail"

);

429

check_node.

SetString

(

"message"

,

"Cannot find the check description"

);

437  check

.HealthCommand,

438  check

.HealthCommandTimeout,

446

checks_node.

Append

(check_node);

447

ret_node.

SetByKey

(

"checks"

, checks_node);

452

reply->SetContentLength(content.size());

456

reply->SetContentLength(0);

461

http_status, reply->GetBytesSent());

470  auto

reply_status = reply->GetStatus(health_timeout);

477

err_msg =

"Timeout on getting a reply status"

;

482  for

(

auto

message = reply->GetNextMessage(); message;

483

message = reply->GetNextMessage()) {

484  if

(!err_msg.empty()) {

491

err_msg =

"Unknown error on reply completion"

;

494  if

(reply_http_code >= 200) {

505  const string

& check_id,

507  const string

& check_description,

509  const string

& health_command,

517

node.

SetString

(

"description"

, check_description);

518

node.

SetString

(

"health-command"

, health_command);

523  if

(check_id ==

"connections"

) {

530

node.

SetString

(

"message"

,

"Current number of client connections is "

+

531

to_string(current_conn_num) +

", which is " 532  "over the soft limit of "

+

539

node.

SetString

(

"message"

,

"The check has succeeded"

);

548  string

err_msg =

""

;

553  bool

request_context_ro = request_context->

GetReadOnly

();

554  if

(request_context_ro)

559

(health_command,

nullptr

, request_context);

566

err_msg =

"Timeout on sending a request"

;

568  for

(

auto

item = reply->GetNextItem(health_timeout);

570

item = reply->GetNextItem(health_timeout)) {

578  auto

item_status = item->GetStatus(health_timeout);

581

err_msg =

"Timeout on getting an item status"

;

587  for

(

auto

message = item->GetNextMessage(); message;

588

message = item->GetNextMessage()) {

589  if

(!err_msg.empty()) {

594  if

(err_msg.empty()) {

595

err_msg =

"Unknown error on item completion"

;

603  if

(request_context_ro)

609

node.

SetString

(

"message"

,

"The check has succeeded"

);

622

shared_ptr<CPSGS_Reply> reply)

624  auto

now = psg_clock_t::now();

638

ret_node.

SetString

(

"message"

,

"Currently does nothing"

);

643

reply->SetContentLength(content.size());

647

reply->SetContentLength(0);

660

shared_ptr<CPSGS_Reply> reply,

661  const string

* payload)

663  switch

(http_status) {

665  if

(payload !=

nullptr

) { reply->SendOk(payload->data(), payload->size(),

false

); }

666  else

{ reply->SendOk(

""

, 0,

true

); }

669  if

(payload !=

nullptr

) { reply->Send400(payload->c_str()); }

670  else

{ reply->Send400(

""

); }

673  if

(payload !=

nullptr

) { reply->Send401(payload->c_str()); }

674  else

{ reply->Send401(

""

); }

677  if

(payload !=

nullptr

) { reply->Send404(payload->c_str()); }

678  else

{ reply->Send404(

""

); }

681  if

(payload !=

nullptr

) { reply->Send409(payload->c_str()); }

682  else

{ reply->Send409(

""

); }

685  if

(payload !=

nullptr

) { reply->Send500(payload->c_str()); }

686  else

{ reply->Send500(

""

); }

689  if

(payload !=

nullptr

) { reply->Send502(payload->c_str()); }

690  else

{ reply->Send502(

""

); }

693  if

(payload !=

nullptr

) { reply->Send503(payload->c_str()); }

694  else

{ reply->Send503(

""

); }

698  string msg

=

"Not supported z end pint http status "

+

699

to_string(http_status);

701

reply->SetContentLength(

msg

.size());

702

reply->Send503(

msg

.c_str());

static CJsonNode NewArrayNode()

Create a new JSON array node.

string Repr(TReprFlags flags=0) const

Return a string representation of this node.

void SetString(const string &key, const string &value)

Set a JSON object element to the specified string value.

void SetInteger(const string &key, Int8 value)

Set a JSON object element to the specified integer value.

void SetByKey(const string &key, CJsonNode::TInstance value)

For a JSON object node, insert a new element or update an existing element.

static CJsonNode NewObjectNode()

Create a new JSON object node.

void Append(CJsonNode::TInstance value)

For an array node, add a new element at the end of the array.

@ ePSGS_ReadyZConnectionsRequest

@ ePSGS_ReadyZCassandraRequest

@ ePSGS_ReadyZLMDBRequest

@ ePSGS_DeepHealthRequest

static shared_ptr< CPSG_Request > CreateRawRequest(string abs_path_ref, shared_ptr< void > user_context, CRef< CRequestContext > request_context)

static int GetReplyHttpCode(const shared_ptr< CPSG_Reply > &reply)

A queue to retrieve data (accession resolution info; bio-sequence; annotation blobs) from the storage...

shared_ptr< CPSG_Reply > SendRequestAndGetReply(shared_ptr< CPSG_Request > request, CDeadline deadline)

Push request into the queue and get corresponding reply.

static TApiLock GetApiLock()

@ eEndOfReply

No more items expected in the (overall!) reply.

void x_InitialzeZEndPointData(void)

int OnReadyzConnections(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

unique_ptr< CHttpDaemon > m_HttpDaemon

void x_SendZEndPointReply(CRequestStatus::ECode http_status, shared_ptr< CPSGS_Reply > reply, const string *payload)

CRequestStatus::ECode x_SelfZEndPointCheckImpl(CRef< CRequestContext > &context, const string &check_id, const string &check_name, const string &check_description, bool verbose, const string &health_command, const CTimeout &health_timeout, CJsonNode &node)

bool x_GetExcludeChecks(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, vector< string > &exclude_checks)

int OnHealthz(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

int OnReadyzCassandra(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

CPSG_Queue::TApiLock m_PSGAPILock

int x_SelfZEndPointCheck(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const string &health_command)

void x_PrintRequestStop(CRef< CRequestContext > &context, CPSGS_Request::EPSGS_Type request_type, CRequestStatus::ECode status, size_t bytes_sent)

SPubseqGatewaySettings m_Settings

int OnReadyzWGS(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

bool x_NeedReadyZCheckPerform(const string &check_name, bool verbose, const vector< string > &exclude_checks, bool &is_critical)

int OnHealth(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

int OnReadyzLMDB(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

CRef< CRequestContext > x_CreateRequestContext(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

unique_ptr< CPSGSCounters > m_Counters

int x_ReadyzHealthzImplementation(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

int OnDeepHealth(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

bool x_IsConnectionAboveSoftLimitForZEndPoints(shared_ptr< CPSGS_Reply > reply, bool verbose)

bool x_IsShuttingDownForZEndPoints(shared_ptr< CPSGS_Reply > reply, bool verbose)

bool x_GetVerboseParameter(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply, const psg_time_point_t &now, bool &verbose)

int OnReadyzSNP(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

int OnReadyzCDD(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

int OnLivez(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

int OnReadyz(CHttpRequest &req, shared_ptr< CPSGS_Reply > reply)

CTimeout – Timeout interval.

bool GetReadOnly(void) const

Get current read-only flag.

void SetReadOnly(bool read_only)

Switch request context to read-only mode.

@ e503_ServiceUnavailable

@ e500_InternalServerError

#define NCBI_THROW(exception_class, err_code, message)

Generic macro to throw an exception, given the exception class, error code and message string.

@ eSuccess

Successfully retrieved.

@ eInProgress

Retrieval is not finalized yet, more info may come.

#define PSG_ERROR(message)

Defines CRequestContext class for NCBI C++ diagnostic API.

static bool check_name(const char *name)

static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

CTimeout HealthCommandTimeout

SCheckDescription(const string &id, const string &name, const string &description)

double m_CassandraHealthTimeoutSec

string m_WGSProcessorHealthCommand

vector< string > m_CriticalDataSources

string m_SNPProcessorHealthCommand

string m_CassandraProcessorHealthCommand

double m_LMDBHealthTimeoutSec

unsigned short m_HttpPort

double m_SNPHealthTimeoutSec

double m_WGSHealthTimeoutSec

string m_LMDBProcessorHealthCommand

int64_t m_TcpMaxConnSoftLimit

string m_CDDProcessorHealthCommand

double m_CDDHealthTimeoutSec

static CS_CONTEXT * context

CRequestStatus::ECode OnReplyComplete(const shared_ptr< CPSG_Reply > &reply, const CTimeout &health_timeout, string &err_msg)

static vector< SCheckDescription > s_CheckDescription

SCheckDescription FindCheckDescription(const string &id)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4