Overview
TheStatus class encapsulates the result of an operation. It may indicate success or an error with an associated error message. Multiple threads can invoke const methods on a Status without external synchronization.
Status Codes
Code Enum
SubCode Enum
Severity Enum
Creating Status Objects
Success Status
Status
Returns a success status
Error Status Constructors
NotFound
Corruption
NotSupported
InvalidArgument
IOError
Incomplete
ShutdownInProgress
Aborted
Busy
TimedOut
TryAgain
Specialized Error Constructors
NoSpace
MemoryLimit
SpaceLimit
PathNotFound
Checking Status
ok
bool
Returns true if the status indicates success
Error Type Checking
IsNotFound
IsCorruption
IsNotSupported
IsInvalidArgument
IsIOError
IsIncomplete
IsShutdownInProgress
IsTimedOut
IsAborted
IsBusy
IsTryAgain
Specialized Error Checking
IsNoSpace
IsMemoryLimit
IsPathNotFound
IsManualCompactionPaused
Accessing Status Information
code
Code
Returns the primary status code
subcode
SubCode
Returns the status subcode for additional error context
severity
Severity
Returns the error severity level
getState
const char*
Returns a C-style string containing the error message
ToString
std::string
Returns a string representation suitable for printing. Returns “OK” for success.
Status Manipulation
UpdateIfOk
Status
Status to potentially adopt
Status&
Returns reference to this Status (allows chaining)
CopyAppendMessage
Unchecked Status Handling
PermitUncheckedError
When ROCKSDB_ASSERT_STATUS_CHECKED is defined, Status objects must be checked before being destroyed, otherwise the program will abort.