template< class Callback> void fetch( void const* key, Callback&& callback, error_code& ec);
The function checks the database for the specified key, and invokes the
callback if it is found. If the key is not found, ec
is set to error::key_not_found. If any other
errors occur, ec
is set
to the corresponding error.
The database must be open.
Safe to call concurrently with any function except close
.
If the implementation encounters an error while committing data to the
database, this function will immediately return with ec
set to the error which occurred. All subsequent calls to fetch
will return the same error
until the database is closed.
A pointer to a memory buffer of at least key_size()
bytes, containing the key to be searched for.
A function which will be called with the value data if the fetch is successful. The equivalent signature must be:
void callback( void const* buffer, // A buffer holding the value std::size_t size // The size of the value in bytes );
The buffer provided to the callback remains valid until the callback returns, ownership is not transferred.
Set to the error, if any occurred.