quasardb C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Enumerations | Functions
Batch functions

Data Structures

struct  int_put_update_t
 The required parameters for an integer operation within a batch. More...
 
struct  blob_put_update_t
 The required parameters for a blob put or update operations within a batch. More...
 
struct  string_put_update_t
 The required parameters for a string put or update operations within a batch. More...
 
struct  double_put_update_t
 The required parameters for a double operation within a batch. More...
 
struct  timestamp_put_update_t
 The required parameters for a timestamp operation within a batch. More...
 
struct  tag_update_attach_t
 The required parameters for an tag operation within a batch. More...
 
struct  qdb_operation_t
 A single operation containing all parameters to execute the operation in a batch or in a transaction. More...
 

Enumerations

enum  qdb_operation_type_t {
  qdb_op_uninitialized = -1, qdb_op_blob_get = 0, qdb_op_blob_put = 1, qdb_op_blob_update = 2,
  qdb_op_blob_cas = 4, qdb_op_blob_get_and_update = 5, qdb_op_blob_remove = 28, qdb_op_has_tag = 8,
  qdb_op_int_put = 9, qdb_op_int_update = 10, qdb_op_int_get = 11, qdb_op_int_add = 12,
  qdb_op_int_remove = 29, qdb_op_get_entry_type = 13, qdb_op_value_get = 14, qdb_op_double_put = 15,
  qdb_op_double_update = 16, qdb_op_double_get = 17, qdb_op_double_add = 18, qdb_op_double_remove = 30,
  qdb_op_string_get = 19, qdb_op_string_put = 20, qdb_op_string_update = 21, qdb_op_string_cas = 22,
  qdb_op_string_get_and_update = 23, qdb_op_string_remove = 31, qdb_op_timestamp_put = 24, qdb_op_timestamp_update = 25,
  qdb_op_timestamp_get = 26, qdb_op_timestamp_add = 27, qdb_op_timestamp_remove = 32, qdb_op_trim_entry = 33,
  qdb_op_tag_detach_all = 34, qdb_op_tag_update = 35, qdb_op_tag_attach = 36, qdb_op_tag_detach = 37
}
 An enumeration of possible operation type. More...
 

Functions

QDB_API_LINKAGE qdb_error_t qdb_init_operations (qdb_operation_t *operations, size_t operation_count)
 Initializes an array of qdb_operation_t. More...
 
QDB_API_LINKAGE qdb_error_t qdb_coalesce_operations (qdb_handle_t handle, qdb_operation_t *operations, size_t operation_count, qdb_operation_t **coalesced_operations, size_t *coalesced_operation_count)
 Coalesces an array of qdb_operation_t. More...
 
QDB_API_LINKAGE size_t qdb_run_batch (qdb_handle_t handle, qdb_operation_t *operations, size_t operation_count)
 Runs the operations in batch. More...
 
QDB_API_LINKAGE qdb_error_t qdb_run_transaction (qdb_handle_t handle, qdb_operation_t *operations, size_t operation_count, size_t *failure_index)
 Runs the operations in a single transaction. More...
 

Detailed Description

Enumeration Type Documentation

An enumeration of possible operation type.

Operations are used by batches and transactions.

Enumerator
qdb_op_uninitialized 

Unitialized value.

qdb_op_blob_get 

A blob get operation.

qdb_op_blob_put 

A blob put operation.

qdb_op_blob_update 

A blob update operation.

qdb_op_blob_cas 

A blob compare and swap operation.

qdb_op_blob_get_and_update 

A blob get and update.

qdb_op_blob_remove 

A blob remove operation.

qdb_op_has_tag 

Tag existence test operation.

qdb_op_int_put 

An integer put operation.

qdb_op_int_update 

An integer update operation.

qdb_op_int_get 

An integer get operation.

qdb_op_int_add 

An integer increase/decrease operation.

qdb_op_int_remove 

An integer remove operation.

qdb_op_get_entry_type 

Entry type check.

qdb_op_value_get 

A value get operation.

qdb_op_double_put 

A double put operation.

qdb_op_double_update 

A double update operation.

qdb_op_double_get 

A double get operation.

qdb_op_double_add 

A double increase/decrease operation.

qdb_op_double_remove 

A double remove operation.

qdb_op_string_get 

A string get operation.

qdb_op_string_put 

A string put operation.

qdb_op_string_update 

A string update operation.

qdb_op_string_cas 

A string compare and swap operation.

qdb_op_string_get_and_update 

A string get and update.

qdb_op_string_remove 

A string remove operation.

qdb_op_timestamp_put 

A timestamp put operation.

qdb_op_timestamp_update 

A timestamp update operation.

qdb_op_timestamp_get 

A timestamp get operation.

qdb_op_timestamp_add 

A timestamp increase/decrease operation.

qdb_op_timestamp_remove 

A timestamp remove operation.

qdb_op_trim_entry 

An entry trimming operation.

qdb_op_tag_detach_all 

A detach all tags operation.

qdb_op_tag_update 

A tag update operation.

qdb_op_tag_attach 

A tag attach operation.

qdb_op_tag_detach 

A tag leaf remove operation.

Function Documentation

QDB_API_LINKAGE qdb_error_t qdb_coalesce_operations ( qdb_handle_t  handle,
qdb_operation_t operations,
size_t  operation_count,
qdb_operation_t **  coalesced_operations,
size_t *  coalesced_operation_count 
)

Coalesces an array of qdb_operation_t.

Use this function to minimize operations to a given entry by omiting redundant operations, combining multiple write operations, and resolving known read operations.

After this function has been called, operations in the input array that were resolved locally will have an error code indicating success. The remaining input operations will have qdb_e_skipped as error code, and their effects will be subsumed by operations in the output array of coalesced operations. All operations are assumed to succeed, if a coalesced operation fails locally resolved operations on the same entry are considered invalid.

This function allocates memory for the array of coalesced operations, call qdb_release on the coalesced_operations array to release memory.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
operationsA pointer to a correctly constructed array of operations
operation_countThe number of elements in the array of operations
coalesced_operationsA pointer to the array of coalesced operations
coalesced_operation_countA pointer to the number of elements in the array of coalesced operations
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_operation_t, qdb_run_batch, qdb_release
QDB_API_LINKAGE qdb_error_t qdb_init_operations ( qdb_operation_t operations,
size_t  operation_count 
)

Initializes an array of qdb_operation_t.

Use this function to make sure all the fields of the operation structure are properly initialized to their default values.

After this function has been called, the user must then set the required parameter for each operation.

Parameters
operationsA pointer to an array of operations
operation_countThe number of elements in the array of operations
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_operation_t
QDB_API_LINKAGE size_t qdb_run_batch ( qdb_handle_t  handle,
qdb_operation_t operations,
size_t  operation_count 
)

Runs the operations in batch.

When operations are run in batch the order of execution is optimized for speed and each operation is run independently.

Running operations is batch is generally the best way to achieve a very high level of performance, especially for bulk loading of data. That's because batches minimize network communication and organize the order of execution for maximum throughput.

If one or several operations within the batch fail, the rest of the batch isn't affected.

If one or several operations within the batch is ill-formed, the whole batch will be aborted. An ill formed operation is for example an operation missing a parameter.

Each operation will result a result according to its type.

After a batch has been run (successful or not), the user must call qdb_release on the operations pointer to release all API-allocated buffers.

For an ordered, transactional "all or nothing" behavior use qdb_run_transaction.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
operationsA pointer to a correctly constructed array of operations
operation_countThe number of elements in the array of operations
Returns
The number of successful operations in the batch.
See Also
qdb_operation_t, qdb_run_transaction, qdb_release
QDB_API_LINKAGE qdb_error_t qdb_run_transaction ( qdb_handle_t  handle,
qdb_operation_t operations,
size_t  operation_count,
size_t *  failure_index 
)

Runs the operations in a single transaction.

Operations that run in a transaction will be executed ordered to preserve the logic of the transaction and if an error occurred the previously executed operations will be rolled back.

The operation is committed if and only if all operations have been successful.

The result of the transaction is not visible by other clients until it has been committed.

After a transaction has been run (successful or not), the user must call qdb_release on operations to release all API-allocated buffers.

Use transactions when integrity and order is paramount. For maximum performances consider using batches (qdb_run_batch).

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
operationsA pointer to a correctly constructed array of operations
operation_countThe number of elements in the array of operations
failure_indexA pointer to the index of the first failed operation
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_operation_t, qdb_run_batch, qdb_release