NCBI C++ ToolKit
Classes | Functions | Variables
nc_utils.cpp File Reference
#include "nc_pch.hpp"
#include "nc_utils.hpp"
+ Include dependency graph for nc_utils.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SStatusMsg
 
class  NCAlertData
 
struct  AlertToId
 

Functions

void InitClientMessages (void)
 Initializes maps between status codes and error texts sent to client to explain these codes. More...
 
EHTTPStatus GetStatusByMessage (const string &msg, EHTTPStatus def)
 
const stringGetMessageByStatus (EHTTPStatus sts)
 

Variables

static map< EHTTPStatus, strings_MsgForStatus
 
static map< string, EHTTPStatuss_StatusForMsg
 
static string s_UnkStatus = "ERR: Unknown status"
 
static SStatusMsg s_StatusMessages []
 
static CMiniMutex s_Lock
 
static map< CNCAlerts::EAlertType, NCAlertDatas_Alerts
 
static const AlertToId s_alertToIdMap []
 
static const size_t s_alertToIdMapSize = sizeof(s_alertToIdMap) / sizeof(AlertToId)
 

Function Documentation

◆ GetMessageByStatus()

const string& GetMessageByStatus ( EHTTPStatus  sts)

◆ GetStatusByMessage()

EHTTPStatus GetStatusByMessage ( const string msg,
EHTTPStatus  def 
)

◆ InitClientMessages()

void InitClientMessages ( void  )

Initializes maps between status codes and error texts sent to client to explain these codes.

Definition at line 74 of file nc_utils.cpp.

References i, SStatusMsg::msg, s_MsgForStatus, s_StatusForMsg, s_StatusMessages, and SStatusMsg::status.

Referenced by s_Initialize().

Variable Documentation

◆ s_Alerts

map< CNCAlerts::EAlertType, NCAlertData > s_Alerts
static

Definition at line 142 of file nc_utils.cpp.

Referenced by CNCAlerts::Acknowledge(), CNCAlerts::Register(), and CNCAlerts::Report().

◆ s_alertToIdMap

const AlertToId s_alertToIdMap[]
static

Definition at line 222 of file nc_utils.cpp.

Referenced by CNCAlerts::x_IdToType(), and CNCAlerts::x_TypeToId().

◆ s_alertToIdMapSize

const size_t s_alertToIdMapSize = sizeof(s_alertToIdMap) / sizeof(AlertToId)
static

Definition at line 290 of file nc_utils.cpp.

Referenced by CNCAlerts::x_IdToType(), and CNCAlerts::x_TypeToId().

◆ s_Lock

CMiniMutex s_Lock
static

Definition at line 141 of file nc_utils.cpp.

Referenced by CNCAlerts::Acknowledge(), CNCAlerts::Register(), and CNCAlerts::Report().

◆ s_MsgForStatus

map<EHTTPStatus, string> s_MsgForStatus
static

Definition at line 39 of file nc_utils.cpp.

Referenced by GetMessageByStatus(), and InitClientMessages().

◆ s_StatusForMsg

map<string, EHTTPStatus> s_StatusForMsg
static

Definition at line 41 of file nc_utils.cpp.

Referenced by GetStatusByMessage(), and InitClientMessages().

◆ s_StatusMessages

SStatusMsg s_StatusMessages[]
static
Initial value:
=
{
{eStatus_JustStarted, "ERR:Caching is not completed"},
{eStatus_Disabled, "ERR:Cache is disabled"},
{eStatus_NotAllowed, "ERR:Password in the command doesn't match server settings"},
{eStatus_NoDiskSpace, "ERR:Not enough disk space"},
{eStatus_BadPassword, "ERR:Access denied."},
{eStatus_NotFound, "ERR:BLOB not found."},
{eStatus_CondFailed, "ERR:Precondition failed"},
{eStatus_NoImpl, "ERR:Not implemented"},
{eStatus_ShuttingDown,"ERR:Service unavailable"},
{eStatus_BlobTooBig, "ERR:Blob size exceeds the allowed maximum"},
{eStatus_NeedAdmin, "ERR:Command requires administrative privileges"},
{eStatus_CmdAborted, "ERR:Stale synchronization"},
{eStatus_PrematureClose, "ERR:Connection closed too early"},
{eStatus_CmdTimeout, "ERR:Command timeout"},
{eStatus_BadPeer, "ERR:Protocol error"}
}
@ eStatus_CmdTimeout
Command timeout is exceeded.
Definition: nc_utils.hpp:136
@ eStatus_Disabled
Client was disabled in configuration.
Definition: nc_utils.hpp:127
@ eStatus_BlobTooBig
Blob size exceeds the allowed maximum.
Definition: nc_utils.hpp:145
@ eStatus_PrematureClose
Connection was closed too early (client didn't send all data or didn't get confirmation about success...
Definition: nc_utils.hpp:148
@ eStatus_NotFound
Blob was not found.
Definition: nc_utils.hpp:129
@ eStatus_NoDiskSpace
There's not enough disk space to execute the command.
Definition: nc_utils.hpp:165
@ eStatus_NeedAdmin
Command requires admin privileges.
Definition: nc_utils.hpp:134
@ eStatus_NoImpl
Command is not implemented.
Definition: nc_utils.hpp:153
@ eStatus_CondFailed
Precondition stated in command has failed (size of blob was given but data has a different size)
Definition: nc_utils.hpp:143
@ eStatus_NotAllowed
Operation not allowed with current settings (e.g.
Definition: nc_utils.hpp:132
@ eStatus_CmdAborted
Definition: nc_utils.hpp:151
@ eStatus_BadPassword
Bad password for accessing the blob.
Definition: nc_utils.hpp:125
@ eStatus_BadPeer
Peer returned something wrong.
Definition: nc_utils.hpp:155
@ eStatus_JustStarted
Command cannot be executed because NetCache didn't cache the database contents yet.
Definition: nc_utils.hpp:161
@ eStatus_ShuttingDown
operation canceled because server needs to shutdown.
Definition: nc_utils.hpp:157

Definition at line 52 of file nc_utils.cpp.

Referenced by InitClientMessages().

◆ s_UnkStatus

string s_UnkStatus = "ERR: Unknown status"
static

Definition at line 51 of file nc_utils.cpp.

Referenced by GetMessageByStatus().

Modified on Sun Apr 21 03:38:26 2024 by modify_doxy.py rev. 669887