Table of WiredTiger extension methods. More...
Public Attributes | |
int(* | err_printf )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *fmt,...) |
Insert an error message into the WiredTiger error stream. More... | |
int(* | msg_printf )(WT_EXTENSION_API *, WT_SESSION *session, const char *fmt,...) |
Insert a message into the WiredTiger message stream. More... | |
const char *(* | strerror )(int err) |
Return information about an error as a string; the strerror method is a superset of the ISO C99/POSIX 1003.1-2001 function strerror. More... | |
void *(* | scr_alloc )(WT_EXTENSION_API *wt_api, WT_SESSION *session, size_t bytes) |
Allocate short-term use scratch memory. More... | |
void(* | scr_free )(WT_EXTENSION_API *, WT_SESSION *session, void *ref) |
Free short-term use scratch memory. More... | |
int(* | collator_config )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_CONFIG_ARG *config) |
Configure the extension collator method. More... | |
int(* | collate )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_ITEM *first, WT_ITEM *second, int *cmp) |
The extension collator method. More... | |
int(* | config_parser_open )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *config, size_t len, WT_CONFIG_PARSER **config_parserp) |
Create a handle that can be used to parse or create configuration strings compatible with WiredTiger APIs. More... | |
int(* | config_get )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_CONFIG_ARG *config, const char *key, WT_CONFIG_ITEM *value) |
Return the value of a configuration string. More... | |
int(* | metadata_insert )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key, const char *value) |
Insert a row into the metadata if it does not already exist. More... | |
int(* | metadata_remove )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key) |
Remove a row from the metadata. More... | |
int(* | metadata_search )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key, const char **valuep) |
Return a row from the metadata. More... | |
int(* | metadata_update )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key, const char *value) |
Update a row in the metadata by either inserting a new record or updating an existing record. More... | |
int(* | struct_pack )(WT_EXTENSION_API *wt_api, WT_SESSION *session, void *buffer, size_t size, const char *format,...) |
Pack a structure into a buffer. More... | |
int(* | struct_size )(WT_EXTENSION_API *wt_api, WT_SESSION *session, size_t *sizep, const char *format,...) |
Calculate the size required to pack a structure. More... | |
int(* | struct_unpack )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const void *buffer, size_t size, const char *format,...) |
Unpack a structure from a buffer. More... | |
uint64_t(* | transaction_id )(WT_EXTENSION_API *wt_api, WT_SESSION *session) |
Return the current transaction ID. More... | |
int(* | transaction_isolation_level )(WT_EXTENSION_API *wt_api, WT_SESSION *session) |
Return the current transaction's isolation level; returns one of WT_TXN_ISO_READ_COMMITTED, WT_TXN_ISO_READ_UNCOMMITTED, or WT_TXN_ISO_SNAPSHOT. More... | |
int(* | transaction_notify )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_TXN_NOTIFY *notify) |
Request notification of transaction resolution by specifying a function to be called when the session's current transaction is either committed or rolled back. More... | |
uint64_t(* | transaction_oldest )(WT_EXTENSION_API *wt_api) |
Return the oldest transaction ID not yet visible to a running transaction. More... | |
int(* | transaction_visible )(WT_EXTENSION_API *wt_api, WT_SESSION *session, uint64_t transaction_id) |
Return if the current transaction can see the given transaction ID. More... | |
const char *(* | version )(int *majorp, int *minorp, int *patchp) |
Get version information. More... | |
Table of WiredTiger extension methods.
This structure is used to provide a set of WiredTiger methods to extension modules without needing to link the modules with the WiredTiger library.
The extension methods may be used both by modules that are linked with the WiredTiger library (for example, a data source configured using the WT_CONNECTION::add_data_source method), and by modules not linked with the WiredTiger library (for example, a compression module configured using the WT_CONNECTION::add_compressor method).
To use these functions:
The following code is from the sample compression module, where compression extension functions are configured in the extension's entry point:
int(* WT_EXTENSION_API::collate)(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_ITEM *first, WT_ITEM *second, int *cmp) |
The extension collator method.
wt_api | the extension handle | |
session | the session handle (or NULL if none available) | |
first | first item | |
second | second item | |
[out] | cmp | set less than 0 if first collates less than second , set equal to 0 if first collates equally to second , set greater than 0 if first collates greater than second |
int(* WT_EXTENSION_API::collator_config)(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_CONFIG_ARG *config) |
Configure the extension collator method.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
config | the configuration information passed to an application |
int(* WT_EXTENSION_API::config_get)(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_CONFIG_ARG *config, const char *key, WT_CONFIG_ITEM *value) |
Return the value of a configuration string.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
key | configuration key string |
config | the configuration information passed to an application |
value | the returned value |
int(* WT_EXTENSION_API::config_parser_open)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *config, size_t len, WT_CONFIG_PARSER **config_parserp) |
Create a handle that can be used to parse or create configuration strings compatible with WiredTiger APIs.
This API is outside the scope of a WiredTiger connection handle, since applications may need to generate configuration strings prior to calling wiredtiger_open.
session | the session handle to be used for error reporting. If NULL error messages will be written to stdout. | |
config | the configuration string being parsed. The string must remain valid for the lifetime of the parser handle. | |
len | the number of valid bytes in config | |
[out] | config_parserp | A pointer to the newly opened handle |
int(* WT_EXTENSION_API::err_printf)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *fmt,...) |
Insert an error message into the WiredTiger error stream.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
fmt | a printf-like format specification |
int(* WT_EXTENSION_API::metadata_insert)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key, const char *value) |
Insert a row into the metadata if it does not already exist.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
key | row key |
value | row value |
int(* WT_EXTENSION_API::metadata_remove)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key) |
Remove a row from the metadata.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
key | row key |
int(* WT_EXTENSION_API::metadata_search)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key, const char **valuep) |
Return a row from the metadata.
wt_api | the extension handle | |
session | the session handle (or NULL if none available) | |
key | row key | |
[out] | valuep | the row value |
int(* WT_EXTENSION_API::metadata_update)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *key, const char *value) |
Update a row in the metadata by either inserting a new record or updating an existing record.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
key | row key |
value | row value |
int(* WT_EXTENSION_API::msg_printf)(WT_EXTENSION_API *, WT_SESSION *session, const char *fmt,...) |
Insert a message into the WiredTiger message stream.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
fmt | a printf-like format specification |
void*(* WT_EXTENSION_API::scr_alloc)(WT_EXTENSION_API *wt_api, WT_SESSION *session, size_t bytes) |
Allocate short-term use scratch memory.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
bytes | the number of bytes of memory needed |
void(* WT_EXTENSION_API::scr_free)(WT_EXTENSION_API *, WT_SESSION *session, void *ref) |
Free short-term use scratch memory.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
ref | a memory reference returned by WT_EXTENSION_API::scr_alloc |
const char*(* WT_EXTENSION_API::strerror)(int err) |
Return information about an error as a string; the strerror method is a superset of the ISO C99/POSIX 1003.1-2001 function strerror.
err | a return value from a WiredTiger, C library or POSIX function |
int(* WT_EXTENSION_API::struct_pack)(WT_EXTENSION_API *wt_api, WT_SESSION *session, void *buffer, size_t size, const char *format,...) |
Pack a structure into a buffer.
See wiredtiger_struct_pack for details.
wt_api | the extension handle |
session | the session handle |
buffer | a pointer to a packed byte array |
size | the number of valid bytes in the buffer |
format | the data format, see Packing and Unpacking Data |
int(* WT_EXTENSION_API::struct_size)(WT_EXTENSION_API *wt_api, WT_SESSION *session, size_t *sizep, const char *format,...) |
Calculate the size required to pack a structure.
See wiredtiger_struct_size for details.
wt_api | the extension handle |
session | the session handle |
sizep | a location where the number of bytes needed for the matching call to WT_EXTENSION_API::struct_pack is returned |
format | the data format, see Packing and Unpacking Data |
int(* WT_EXTENSION_API::struct_unpack)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const void *buffer, size_t size, const char *format,...) |
Unpack a structure from a buffer.
See wiredtiger_struct_unpack for details.
wt_api | the extension handle |
session | the session handle |
buffer | a pointer to a packed byte array |
size | the number of valid bytes in the buffer |
format | the data format, see Packing and Unpacking Data |
uint64_t(* WT_EXTENSION_API::transaction_id)(WT_EXTENSION_API *wt_api, WT_SESSION *session) |
Return the current transaction ID.
wt_api | the extension handle |
session | the session handle |
int(* WT_EXTENSION_API::transaction_isolation_level)(WT_EXTENSION_API *wt_api, WT_SESSION *session) |
Return the current transaction's isolation level; returns one of WT_TXN_ISO_READ_COMMITTED, WT_TXN_ISO_READ_UNCOMMITTED, or WT_TXN_ISO_SNAPSHOT.
wt_api | the extension handle |
session | the session handle |
int(* WT_EXTENSION_API::transaction_notify)(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_TXN_NOTIFY *notify) |
Request notification of transaction resolution by specifying a function to be called when the session's current transaction is either committed or rolled back.
If the transaction is being committed, but the notification function returns an error, the transaction will be rolled back.
wt_api | the extension handle |
session | the session handle |
notify | a handler for commit or rollback events |
uint64_t(* WT_EXTENSION_API::transaction_oldest)(WT_EXTENSION_API *wt_api) |
Return the oldest transaction ID not yet visible to a running transaction.
wt_api | the extension handle |
session | the session handle |
int(* WT_EXTENSION_API::transaction_visible)(WT_EXTENSION_API *wt_api, WT_SESSION *session, uint64_t transaction_id) |
Return if the current transaction can see the given transaction ID.
wt_api | the extension handle |
session | the session handle |
transaction_id | the transaction ID |
const char*(* WT_EXTENSION_API::version)(int *majorp, int *minorp, int *patchp) |
Get version information.
majorp | a location where the major version number is returned |
minorp | a location where the minor version number is returned |
patchp | a location where the patch version number is returned |