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_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(* | config_strget )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *config, const char *key, WT_CONFIG_ITEM *value) |
Return the value of a configuration string. More... | |
int(* | config_scan_begin )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *str, size_t len, WT_CONFIG_SCAN **scanp) |
Return the list entries of a configuration string value. More... | |
int(* | config_scan_end )(WT_EXTENSION_API *wt_api, WT_CONFIG_SCAN *scan) |
Release any resources allocated by WT_EXTENSION_API::config_scan_begin. More... | |
int(* | config_scan_next )(WT_EXTENSION_API *wt_api, WT_CONFIG_SCAN *scan, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value) |
Return the next key/value pair from a config string scan. 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... | |
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_scan_begin)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *str, size_t len, WT_CONFIG_SCAN **scanp) |
Return the list entries of a configuration string value.
This method steps through the entries found in the last returned value from WT_EXTENSION_API::config_get. The last returned value should be of type "list".
wt_api | the extension handle | |
session | the session handle (or NULL if none available) | |
str | the configuration string to scan | |
len | the number of valid bytes in str | |
[out] | scanp | a handle used to scan the config string |
int(* WT_EXTENSION_API::config_scan_end)(WT_EXTENSION_API *wt_api, WT_CONFIG_SCAN *scan) |
Release any resources allocated by WT_EXTENSION_API::config_scan_begin.
wt_api | the extension handle |
scan | the configuration scanner, invalid after this call |
int(* WT_EXTENSION_API::config_scan_next)(WT_EXTENSION_API *wt_api, WT_CONFIG_SCAN *scan, WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value) |
Return the next key/value pair from a config string scan.
If the string contains a list of items with no assigned value, the items will be returned in key
and the value
will be set to the boolean "true"
value.
wt_api | the extension handle |
scan | the configuration scanner |
key | the returned key |
value | the returned value |
int(* WT_EXTENSION_API::config_strget)(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *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) |
config | a configuration string |
key | configuration key string |
value | the returned value |
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 |