quasardb C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Double-precision floating point numbers

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...
 

Detailed Description

Function Documentation

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:

  • To increase the value, specify a positive addend
  • To decrease the value, specify a negative addend

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.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
aliasA pointer to a null-terminated UTF-8 string representing the alias of the entry.
addendThe value to add to the existing value.
resultA pointer to a timestamp that will receive the current value of the entry, if successful.
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_timestamp_put, qdb_timestamp_update, qdb_timestamp_get
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.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
aliasA pointer to a null-terminated UTF-8 string representing the alias of the entry.
valueA pointer to a timestamp that will receive the current value of the entry, if successful.
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_timestamp_put, qdb_timestamp_update, qdb_timestamp_add
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.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
aliasA pointer to a null-terminated UTF-8 string representing the alias of the entry.
valueThe value to which the number must be set.
expiry_timeAn optional absolute expiry time expressed in UTC UNIX epoch.
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_timestamp_update, qdb_timestamp_get, qdb_timestamp_add
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.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
aliasA pointer to a null-terminated UTF-8 string representing the alias of the entry.
valueThe value to which the timestamp must be set.
expiry_timeAn optional absolute expiry time expressed in UTC UNIX epoch.
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_timestamp_put, qdb_timestamp_get, qdb_timestamp_add