A WT_ASYNC_OP handle is the interface to an asynchronous operation. More...
Public Member Functions | |
int | search (WT_ASYNC_OP *op) |
Return the record matching the key. More... | |
Data access | |
int | get_key (WT_ASYNC_OP *op,...) |
Get the key for the current record. More... | |
int | get_value (WT_ASYNC_OP *op,...) |
Get the value for the current record. More... | |
void | set_key (WT_ASYNC_OP *op,...) |
Set the key for the next operation. More... | |
void | set_value (WT_ASYNC_OP *op,...) |
Set the value for the next operation. More... | |
Data modification | |
int | insert (WT_ASYNC_OP *op) |
Insert a record and optionally update an existing record. More... | |
int | update (WT_ASYNC_OP *op) |
Update a record and optionally insert an existing record. More... | |
int | remove (WT_ASYNC_OP *op) |
Remove a record. More... | |
int | compact (WT_ASYNC_OP *op) |
Compact a live row- or column-store btree or LSM tree. More... | |
uint64_t | get_id (WT_ASYNC_OP *op) |
Get the unique identifier for this operation. More... | |
WT_ASYNC_OPTYPE | get_type (WT_ASYNC_OP *op) |
Get the type for this operation. More... | |
Public Attributes | |
WT_CONNECTION * | connection |
The connection for this operation. More... | |
const char * | key_format |
The format of the data packed into key items. More... | |
const char * | value_format |
The format of the data packed into value items. More... | |
void * | app_private |
A location for applications to store information that will be available in the callback from an async operation. | |
A WT_ASYNC_OP handle is the interface to an asynchronous operation.
An asynchronous operation describes a data manipulation to be performed asynchronously by a WiredTiger worker thread. These operations implement the CRUD (create, read, update and delete) operations. Each operation is a self-contained work unit. The operation will be performed in the context of the worker thread's session. Each operation is performed within the context of a transaction. The application is notified of its completion with a callback. The transaction is resolved once the callback returns.
The table referenced in an operation must already exist.
Raw data is represented by key/value pairs of WT_ITEM structures, but operations can also provide access to fields within the key and value if the formats are described in the WT_SESSION::create method.
Thread safety: A WT_ASYNC_OP handle is not shared between threads.
int WT_ASYNC_OP::compact | ( | WT_ASYNC_OP * | op | ) |
Compact a live row- or column-store btree or LSM tree.
op | the operation handle |
uint64_t WT_ASYNC_OP::get_id | ( | WT_ASYNC_OP * | op | ) |
Get the unique identifier for this operation.
op | the operation handle |
int WT_ASYNC_OP::get_key | ( | WT_ASYNC_OP * | op, |
... | |||
) |
Get the key for the current record.
op | the operation handle |
... | pointers to hold key fields corresponding to WT_ASYNC_OP::key_format. |
WT_ASYNC_OPTYPE WT_ASYNC_OP::get_type | ( | WT_ASYNC_OP * | op | ) |
Get the type for this operation.
op | the operation handle |
int WT_ASYNC_OP::get_value | ( | WT_ASYNC_OP * | op, |
... | |||
) |
Get the value for the current record.
op | the operation handle |
... | pointers to hold value fields corresponding to WT_ASYNC_OP::value_format. |
int WT_ASYNC_OP::insert | ( | WT_ASYNC_OP * | op | ) |
Insert a record and optionally update an existing record.
If the operation was configured with "overwrite=true" (the default), both the key and value must be set; if the record already exists, the key's value will be updated, otherwise, the record will be inserted.
If the operation was not configured with "overwrite=true", both the key and value must be set and the record must not already exist; the record will be inserted.
If an operation with record number keys was configured with "append=true" (not the default), the value must be set; a new record will be appended and the record number set as the operation's key value.
Inserting a new record after the current maximum record in a fixed-length bit field column-store (that is, a store with an 'r' type key and 't' type value) may implicitly create the missing records as records with a value of 0.
When loading a large amount of data into a new object, using normal cursor operations with the bulk
configuration string enabled will be much faster than asynchronous operations.
The maximum length of a single column stored in a table is not fixed (as it partially depends on the underlying file configuration), but is always a small number of bytes less than 4GB.
op | the operation handle |
overwrite
is not configured and a record with the specified key already exists, WT_DUPLICATE_KEY is returned. int WT_ASYNC_OP::remove | ( | WT_ASYNC_OP * | op | ) |
Remove a record.
If the operation was configured with "overwrite=true" (the default), the key must be set; the key's record will be removed if it exists, no error will be returned if the record does not exist.
If the operation was not configured with "overwrite=true", the key must be set and the key's record must exist; the record will be removed.
Removing a record in a fixed-length bit field column-store (that is, a store with an 'r' type key and 't' type value) is identical to setting the record's value to 0.
op | the operation handle |
overwrite
is not configured and no record with the specified key exists, WT_NOTFOUND is returned. int WT_ASYNC_OP::search | ( | WT_ASYNC_OP * | op | ) |
Return the record matching the key.
The key must first be set.
On success, the operation contains the returned record.
op | the operation handle |
void WT_ASYNC_OP::set_key | ( | WT_ASYNC_OP * | op, |
... | |||
) |
Set the key for the next operation.
op | the operation handle |
... | key fields corresponding to WT_ASYNC_OP::key_format. |
If an error occurs during this operation, a flag will be set in the operation, and the next operation to access the key will fail. This simplifies error handling in applications.
void WT_ASYNC_OP::set_value | ( | WT_ASYNC_OP * | op, |
... | |||
) |
Set the value for the next operation.
op | the operation handle |
... | value fields corresponding to WT_ASYNC_OP::value_format. |
If an error occurs during this operation, a flag will be set in the operation, and the next operation to access the value will fail This simplifies error handling in applications.
int WT_ASYNC_OP::update | ( | WT_ASYNC_OP * | op | ) |
Update a record and optionally insert an existing record.
If the operation was configured with "overwrite=true" (the default), both the key and value must be set; if the record already exists, the key's value will be updated, otherwise, the record will be inserted.
If the operation was not configured with "overwrite=true", both the key and value must be set and the record must already exist; the record will be updated.
The maximum length of a single column stored in a table is not fixed (as it partially depends on the underlying file configuration), but is always a small number of bytes less than 4GB.
op | the operation handle |
overwrite
is not configured and no record with the specified key exists, WT_NOTFOUND is returned. WT_CONNECTION* WT_ASYNC_OP::connection |
The connection for this operation.
const char* WT_ASYNC_OP::key_format |
The format of the data packed into key items.
See Packing and Unpacking Data for details. If not set, a default value of "u" is assumed, and applications must use WT_ITEM structures to manipulate untyped byte arrays.
const char* WT_ASYNC_OP::value_format |
The format of the data packed into value items.
See Packing and Unpacking Data for details. If not set, a default value of "u" is assumed, and applications must use WT_ITEM structures to manipulate untyped byte arrays.