Version 2.6.1
WT_ASYNC_OP Struct Reference

A WT_ASYNC_OP handle is the interface to an asynchronous operation. More...

Public Member Functions

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...
 
Data access
int get_key (WT_ASYNC_OP *op,...)
 Invoke the underlying WT_CURSOR::get_key method; see that method for configuration, return and error values. More...
 
int get_value (WT_ASYNC_OP *op,...)
 Invoke the underlying WT_CURSOR::get_value method; see that method for configuration, return and error values. More...
 
void set_key (WT_ASYNC_OP *op,...)
 Invoke the underlying WT_CURSOR::set_key method; see that method for configuration, return and error values. More...
 
void set_value (WT_ASYNC_OP *op,...)
 Invoke the underlying WT_CURSOR::set_value method; see that method for configuration, return and error values. More...
 
Positioning
int search (WT_ASYNC_OP *op)
 Invoke the underlying WT_CURSOR::search method; see that method for configuration, return and error values. More...
 
Data modification
int insert (WT_ASYNC_OP *op)
 Invoke the underlying WT_CURSOR::insert method; see that method for configuration, return and error values. More...
 
int update (WT_ASYNC_OP *op)
 Invoke the underlying WT_CURSOR::update method; see that method for configuration, return and error values. More...
 
int remove (WT_ASYNC_OP *op)
 Invoke the underlying WT_CURSOR::remove method; see that method for configuration, return and error values. More...
 
Table operations
int compact (WT_ASYNC_OP *op)
 Invoke the underlying WT_SESSION::compact method; see that method for configuration, return and error values. More...
 

Public Attributes

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

Detailed Description

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 may not be shared between threads, see Multithreading for more information.

Examples:
ex_async.c.

Member Function Documentation

int WT_ASYNC_OP::compact ( WT_ASYNC_OP op)

Invoke the underlying WT_SESSION::compact method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Returns
via the callback as described for WT_SESSION::compact
Examples:
ex_async.c.
uint64_t WT_ASYNC_OP::get_id ( WT_ASYNC_OP op)

Get the unique identifier for this operation.

/* Retrieve the operation's 64-bit identifier. */
id = op->get_id(op);
Parameters
opthe operation handle
Returns
the id of the operation
Examples:
ex_async.c.
int WT_ASYNC_OP::get_key ( WT_ASYNC_OP op,
  ... 
)

Invoke the underlying WT_CURSOR::get_key method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Returns
as described for WT_CURSOR::get_key
Examples:
ex_async.c.
WT_ASYNC_OPTYPE WT_ASYNC_OP::get_type ( WT_ASYNC_OP op)

Get the type for this operation.

/* Retrieve the operation's WT_ASYNC_OPTYPE type. */
type = op->get_type(op);
Parameters
opthe operation handle
Returns
the WT_ASYNC_OPTYPE of the operation
Examples:
ex_async.c.
int WT_ASYNC_OP::get_value ( WT_ASYNC_OP op,
  ... 
)

Invoke the underlying WT_CURSOR::get_value method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Returns
as described for WT_CURSOR::get_value
Examples:
ex_async.c.
int WT_ASYNC_OP::insert ( WT_ASYNC_OP op)

Invoke the underlying WT_CURSOR::insert method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Returns
via the callback as described for WT_CURSOR::insert
Examples:
ex_async.c.
int WT_ASYNC_OP::remove ( WT_ASYNC_OP op)

Invoke the underlying WT_CURSOR::remove method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Returns
via the callback as described for WT_CURSOR::remove
int WT_ASYNC_OP::search ( WT_ASYNC_OP op)

Invoke the underlying WT_CURSOR::search method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Returns
via the callback as described for WT_CURSOR::search
Examples:
ex_async.c.
void WT_ASYNC_OP::set_key ( WT_ASYNC_OP op,
  ... 
)

Invoke the underlying WT_CURSOR::set_key method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Examples:
ex_async.c.
void WT_ASYNC_OP::set_value ( WT_ASYNC_OP op,
  ... 
)

Invoke the underlying WT_CURSOR::set_value method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Examples:
ex_async.c.
int WT_ASYNC_OP::update ( WT_ASYNC_OP op)

Invoke the underlying WT_CURSOR::update method; see that method for configuration, return and error values.

Parameters
opthe operation handle
Returns
via the callback as described for WT_CURSOR::update

Member Data Documentation

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.