quasardb C API
|
Functions | |
QDB_API_LINKAGE qdb_error_t | qdb_timestamp_put (qdb_handle_t handle, const char *alias, const qdb_timespec_t *value, qdb_time_t expiry_time) |
Creates a new 128-bit timestamp. More... | |
QDB_API_LINKAGE qdb_error_t | qdb_timestamp_update (qdb_handle_t handle, const char *alias, const qdb_timespec_t *value, qdb_time_t expiry_time) |
Creates or updates a 128-bit timestamp. More... | |
QDB_API_LINKAGE qdb_error_t | qdb_timestamp_get (qdb_handle_t handle, const char *alias, qdb_timespec_t *value) |
Retrieves the value of a 128-bit timestamp. More... | |
QDB_API_LINKAGE qdb_error_t | qdb_timestamp_add (qdb_handle_t handle, const char *alias, const qdb_timespec_t *addend, qdb_timespec_t *result) |
Atomically increases or decreases a 128-bit timestamp. More... | |
QDB_API_LINKAGE qdb_error_t qdb_timestamp_add | ( | qdb_handle_t | handle, |
const char * | alias, | ||
const qdb_timespec_t * | addend, | ||
qdb_timespec_t * | result | ||
) |
Atomically increases or decreases a 128-bit timestamp.
The specified entry will be atomically increased (or decreased) according to the given addend value:
The function return the result of the operation.
The entry must already exist. If the entry is not a timestamp, the function will return qdb_e_incompatible_type.
handle | A valid handle previously initialized by qdb_open or qdb_open_tcp. |
alias | A pointer to a null-terminated UTF-8 string representing the alias of the entry. |
addend | The value to add to the existing value. |
result | A pointer to a timestamp that will receive the current value of the entry, if successful. |
QDB_API_LINKAGE qdb_error_t qdb_timestamp_get | ( | qdb_handle_t | handle, |
const char * | alias, | ||
qdb_timespec_t * | value | ||
) |
Retrieves the value of a 128-bit timestamp.
Atomically retrieves the value of an existing 128-bit timestamp.
If the entry is not a timestamp, the function will return qdb_e_incompatible_type.
handle | A valid handle previously initialized by qdb_open or qdb_open_tcp. |
alias | A pointer to a null-terminated UTF-8 string representing the alias of the entry. |
value | A pointer to a timestamp that will receive the current value of the entry, if successful. |
QDB_API_LINKAGE qdb_error_t qdb_timestamp_put | ( | qdb_handle_t | handle, |
const char * | alias, | ||
const qdb_timespec_t * | value, | ||
qdb_time_t | expiry_time | ||
) |
Creates a new 128-bit timestamp.
Atomically creates an entry of the given alias and sets it to a cross-platform 128-bit timestamp. If the entry already exists, the function returns an error.
You can specify an expiry or use qdb_never_expires if you don't want the entry to expire.
If you want to create or update an entry use qdb_timestamp_update.
The value will be correctly translated independently of the endianness of the client's platform.
handle | A valid handle previously initialized by qdb_open or qdb_open_tcp. |
alias | A pointer to a null-terminated UTF-8 string representing the alias of the entry. |
value | The value to which the number must be set. |
expiry_time | An optional absolute expiry time expressed in UTC UNIX epoch. |
QDB_API_LINKAGE qdb_error_t qdb_timestamp_update | ( | qdb_handle_t | handle, |
const char * | alias, | ||
const qdb_timespec_t * | value, | ||
qdb_time_t | expiry_time | ||
) |
Creates or updates a 128-bit timestamp.
Atomically updates an entry of the given alias to the provided value. If the entry doesn't exist, it will be created. If the entry is not a timestamp, the function will return qdb_e_incompatible_type.
You can specify an expiry time or use qdb_never_expires if you don't want the entry to expire.
handle | A valid handle previously initialized by qdb_open or qdb_open_tcp. |
alias | A pointer to a null-terminated UTF-8 string representing the alias of the entry. |
value | The value to which the timestamp must be set. |
expiry_time | An optional absolute expiry time expressed in UTC UNIX epoch. |