1 #ifndef NETCACHE_NC_UTILS__HPP
2 #define NETCACHE_NC_UTILS__HPP
39 #define ATTR_PACKED NCBI_PACKED
42 # define ATTR_ALIGNED_8 [[aligned(8)]]
43 #elif NCBI_HAS_ATTRIBUTE(gnu::aligned)
44 # define ATTR_ALIGNED_8 [[gnu::aligned(8)]]
45 #elif __has_attribute(aligned)
46 # define ATTR_ALIGNED_8 __attribute__ ((aligned(8)))
48 # define ATTR_ALIGNED_8
74 template <
typename NumType>
static void Register(EAlertType alert_type, const string &message)
static EAlertType x_IdToType(const string &alert_id)
static string x_TypeToId(EAlertType type)
static void Report(CSrvSocketTask &task, bool report_all)
static EAlertAckResult Acknowledge(const string &alert_id, const string &user)
@ eDebugOrphanRecordFound
@ eSyncFailed
Synchronization failed.
@ eDebugReadBlobInfoFailed0
@ eAccessDenied
Command was rejected because client lacks administrative privileges.
@ eStorageReinit
Data storage was reinitialized.
@ eDebugCacheFailedMgrAttach
@ eDebugWriteBlobInfoFailed
@ eDebugOrphanRecordFound2
@ eDebugCacheFailedMgrDetach
@ eDiskSpaceCritical
Free disk space is below critical threshold.
@ eDatabaseTooLarge
Database is too large (warning)
@ eDiskSpaceLow
Free disk space is below threshold.
@ eStartAfterCrash
InstanceGuard file was present on startup.
@ eDebugMoveDataToGarbage
@ eDatabaseOverLimit
Database size exceeded its limit (error, stop write)
@ eDiskSpaceNormal
Free disk space is back to normal.
@ ePeerIpChanged
Peer IP address changed.
@ eDebugReleaseCacheData1
@ eDebugDeleteCNCBlobVerManager
@ ePidFileFailed
Reporting Pid failed.
@ eStartupConfigChanged
Configuration file changed.
@ eDebugReleaseCacheData2
@ eDebugReadBlobInfoFailed1
@ eDebugReadBlobInfoFailed2
@ eDebugDeleteSNCBlobVerData
@ eDebugDeleteVersionData
Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit...
CSimpleBufferT & append(const void *buf, size_t len)
Task controlling a socket.
TNCBufferType & WriteNumber(NumType num)
TNCBufferType & WriteText(const char *buf)
TNCBufferType & WriteText(const string &buf)
TNCBufferType & WriteBool(bool b)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static const char *const kNCPeerClientName
map< string, string > TStringMap
EHTTPStatus
Statuses of commands to be set in diagnostics' request context Additional statuses can be taken from ...
@ eStatus_RaceCond
SETVALID cannot be executed as new version was already written.
@ eStatus_Created
New resource has been created.
@ eStatus_CmdTimeout
Command timeout is exceeded.
@ eStatus_BadCmd
Command is incorrect.
@ eStatus_ServerError
Internal server error.
@ eStatus_PeerError
Command should be proxied to peers but it's impossible to connect to any.
@ eStatus_SyncEvents
SYNC_START: synchronization by events will be performed.
@ eStatus_SyncBusy
Synchronization cannot start because server is busy doing cleaning or some other synchronization on t...
@ eStatus_Disabled
Client was disabled in configuration.
@ eStatus_BlobTooBig
Blob size exceeds the allowed maximum.
@ eStatus_ServiceUnavailable
@ eStatus_SyncAborted
Synchronization is aborted because something went wrong.
@ eStatus_PrematureClose
Connection was closed too early (client didn't send all data or didn't get confirmation about success...
@ eStatus_NotFound
Blob was not found.
@ eStatus_NoDiskSpace
There's not enough disk space to execute the command.
@ eStatus_NewerBlob
Same or newer blob is present on the server.
@ eStatus_CrossSync
Synchronization is rejected because both servers tried to start it simultaneously.
@ eStatus_NeedAdmin
Command requires admin privileges.
@ eStatus_OK
Command is ok and execution is good.
@ eStatus_NoImpl
Command is not implemented.
@ eStatus_CondFailed
Precondition stated in command has failed (size of blob was given but data has a different size)
@ eStatus_NotAllowed
Operation not allowed with current settings (e.g.
@ eStatus_PartialContent
The server is delivering only part of the resource.
@ sStatus_BlobVersion
Blob version did not match.
@ eStatus_BadPassword
Bad password for accessing the blob.
@ eStatus_BadPeer
Peer returned something wrong.
@ eStatus_SyncBList
SYNC_START: synchronization by blobs list will be performed.
@ eStatus_JustStarted
Command cannot be executed because NetCache didn't cache the database contents yet.
@ eStatus_ShuttingDown
operation canceled because server needs to shutdown.
const string & GetMessageByStatus(EHTTPStatus sts)
ENCAccessType
Type of access to NetCache blob.
@ eNCReadData
Read blob data.
@ eNCCopyCreate
(Re-)write blob from another NetCache (as opposed to writing from client)
@ eNCRead
Read meta information only.
@ eNCCreate
Create blob or re-write its contents.
map< Uint8, string > TNCPeerList
vector< Uint8 > TServersList
EHTTPStatus GetStatusByMessage(const string &msg, EHTTPStatus def)
void InitClientMessages(void)
Initializes maps between status codes and error texts sent to client to explain these codes.
#define NCBI_PACKED_ENUM_END()
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)