KV().ReadRaw#
-
static inline const void *YR::KVManager::ReadRaw(const std::string &key, int timeout = DEFAULT_GET_TIMEOUT_SEC)#
Retrieves the value of a key written by WriteRaw.
Warning
When timeout is configured, the Read method will wait for the Write method to complete, up to the timeout. There is no constraint on the order of Read and Write method calls. If a Write operation is followed by an exception such as a ds worker restart, metadata residue must be handled to ensure the Write operation is completed; otherwise, calling Read for the same key will throw an error without waiting for a timeout.
- Parameters:
key – [in] The single key used to query the data.
timeout – [in] Timeout in seconds, default is
300. Range[0, INT_MAX/1000).-1indicates permanent blocking wait.
- Throws:
YR::Exception – Thrown in the following cases:
1001: Invalid input parameters (e.g., empty keys, mismatched sizes, or invalid characters).
4005: Get operation failed (e.g., key not found or timeout exceeded).
4201: RocksDB error (e.g., disk issues).
4202: Shared memory limit exceeded.
4203: Disk operation failed (e.g., permission issues).
4204: Disk space full.
1000, 1001, 1002: Internal communication errors.
- Returns:
Returns the retrieved data.