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 )(WT_EXTENSION_API *, WT_SESSION *session, int error) |
Return information about an error as a string. More... | |
int(* | map_windows_error )(WT_EXTENSION_API *wt_api, WT_SESSION *session, uint32_t windows_error) |
Map a Windows system error code to a POSIX 1003.1/ANSI C error. 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, const char *uri, WT_CONFIG_ARG *config, WT_COLLATOR **collatorp, int *ownp) |
Configure the extension collator method. More... | |
int(* | collate )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_COLLATOR *collator, 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 key. More... | |
int(* | config_get_string )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *config, const char *key, WT_CONFIG_ITEM *value) |
Return the value of a configuration key from a string. 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 the WiredTiger API. More... | |
int(* | config_parser_open_arg )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_CONFIG_ARG *config, WT_CONFIG_PARSER **config_parserp) |
Create a handle that can be used to parse or create configuration strings compatible with the WiredTiger API. More... | |
int(* | file_system_get )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_FILE_SYSTEM **file_system) |
Get the file system abstraction used by WiredTiger. 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, 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... | |
int(* | pack_start )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *format, void *buffer, size_t size, WT_PACK_STREAM **psp) |
Start a packing operation into a buffer. More... | |
int(* | unpack_start )(WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *format, const void *buffer, size_t size, WT_PACK_STREAM **psp) |
Start an unpacking operation from a buffer. More... | |
int(* | pack_close )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, size_t *usedp) |
Close a packing stream. More... | |
int(* | pack_item )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, WT_ITEM *item) |
Pack an item into a packing stream. More... | |
int(* | pack_int )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, int64_t i) |
Pack a signed integer into a packing stream. More... | |
int(* | pack_str )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, const char *s) |
Pack a string into a packing stream. More... | |
int(* | pack_uint )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, uint64_t u) |
Pack an unsigned integer into a packing stream. More... | |
int(* | unpack_item )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, WT_ITEM *item) |
Unpack an item from a packing stream. More... | |
int(* | unpack_int )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, int64_t *ip) |
Unpack a signed integer from a packing stream. More... | |
int(* | unpack_str )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, const char **sp) |
Unpack a string from a packing stream. More... | |
int(* | unpack_uint )(WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, uint64_t *up) |
Unpack an unsigned integer from a packing stream. More... | |
const char *(* | version )(int *majorp, int *minorp, int *patchp) |
Get version information. More... | |
int(* | spin_init )(WT_EXTENSION_API *wt_api, WT_EXTENSION_SPINLOCK *spinlock, const char *name) |
Initialize a spinlock. More... | |
void(* | spin_destroy )(WT_EXTENSION_API *wt_api, WT_EXTENSION_SPINLOCK *spinlock) |
Destroy a spinlock. More... | |
void(* | spin_lock )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_EXTENSION_SPINLOCK *spinlock) |
Spin until the lock is acquired. More... | |
void(* | spin_unlock )(WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_EXTENSION_SPINLOCK *spinlock) |
Release the spinlock. 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_COLLATOR *collator, 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) | |
collator | the collator (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, const char *uri, WT_CONFIG_ARG *config, WT_COLLATOR **collatorp, int *ownp) |
Configure the extension collator method.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
uri | the URI of the handle being configured |
config | the configuration information passed to an application |
collatorp | the selector collator, if any |
ownp | set if the collator terminate method should be called when no longer needed |
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 key.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
config | the configuration information passed to an application |
key | configuration key string |
value | the returned value |
int(* WT_EXTENSION_API::config_get_string) (WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *config, const char *key, WT_CONFIG_ITEM *value) |
Return the value of a configuration key from a string.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
config | the configuration string |
key | configuration key string |
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 the WiredTiger API.
wt_api | the extension handle | |
session | the session handle to be used for error reporting | |
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::config_parser_open_arg) (WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_CONFIG_ARG *config, WT_CONFIG_PARSER **config_parserp) |
Create a handle that can be used to parse or create configuration strings compatible with the WiredTiger API.
wt_api | the extension handle | |
session | the session handle to be used for error reporting | |
config | the configuration argument passed to the extension | |
[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-style format specification |
int(* WT_EXTENSION_API::file_system_get) (WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_FILE_SYSTEM **file_system) |
Get the file system abstraction used by WiredTiger.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
file_system | the returned file system handle. |
int(* WT_EXTENSION_API::map_windows_error) (WT_EXTENSION_API *wt_api, WT_SESSION *session, uint32_t windows_error) |
Map a Windows system error code to a POSIX 1003.1/ANSI C error.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
windows_error | a Windows system error code |
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, 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-style format specification |
int(* WT_EXTENSION_API::pack_close) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, size_t *usedp) |
Close a packing stream.
ps | the packing stream handle | |
[out] | usedp | the number of bytes in the buffer used by the stream |
int(* WT_EXTENSION_API::pack_int) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, int64_t i) |
Pack a signed integer into a packing stream.
ps | the packing stream handle |
i | a signed integer to pack |
int(* WT_EXTENSION_API::pack_item) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, WT_ITEM *item) |
Pack an item into a packing stream.
ps | the packing stream handle |
item | an item to pack |
int(* WT_EXTENSION_API::pack_start) (WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *format, void *buffer, size_t size, WT_PACK_STREAM **psp) |
Start a packing operation into a buffer.
See wiredtiger_pack_start for details.
session | the session handle | |
format | the data format, see Packing and Unpacking Data | |
buffer | a pointer to memory to hold the packed data | |
size | the size of the buffer | |
[out] | psp | the new packing stream handle |
int(* WT_EXTENSION_API::pack_str) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, const char *s) |
Pack a string into a packing stream.
ps | the packing stream handle |
s | a string to pack |
int(* WT_EXTENSION_API::pack_uint) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, uint64_t u) |
Pack an unsigned integer into a packing stream.
ps | the packing stream handle |
u | an unsigned integer to pack |
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 |
void(* WT_EXTENSION_API::spin_destroy) (WT_EXTENSION_API *wt_api, WT_EXTENSION_SPINLOCK *spinlock) |
Destroy a spinlock.
wt_api | the extension handle |
session | the session handle |
spinlock | the extension spinlock |
int(* WT_EXTENSION_API::spin_init) (WT_EXTENSION_API *wt_api, WT_EXTENSION_SPINLOCK *spinlock, const char *name) |
Initialize a spinlock.
wt_api | the extension handle |
session | the session handle |
spinlock | the extension spinlock |
name | the name for the spinlock |
void(* WT_EXTENSION_API::spin_lock) (WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_EXTENSION_SPINLOCK *spinlock) |
Spin until the lock is acquired.
wt_api | the extension handle |
session | the session handle |
spinlock | the extension spinlock |
void(* WT_EXTENSION_API::spin_unlock) (WT_EXTENSION_API *wt_api, WT_SESSION *session, WT_EXTENSION_SPINLOCK *spinlock) |
Release the spinlock.
wt_api | the extension handle |
session | the session handle |
spinlock | the extension spinlock |
const char*(* WT_EXTENSION_API::strerror) (WT_EXTENSION_API *, WT_SESSION *session, int error) |
Return information about an error as a string.
wt_api | the extension handle |
session | the session handle (or NULL if none available) |
error | a return value from a WiredTiger 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.
Deprecated in favor of stream based pack and unpack API. See WT_EXTENSION_API::pack_start 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.
Deprecated in favor of stream based pack and unpack API.
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.
Deprecated in favor of stream based pack and unpack API. See WT_EXTENSION_API::unpack_start 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::unpack_int) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, int64_t *ip) |
Unpack a signed integer from a packing stream.
ps | the packing stream handle | |
[out] | ip | the unpacked signed integer |
int(* WT_EXTENSION_API::unpack_item) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, WT_ITEM *item) |
Unpack an item from a packing stream.
ps | the packing stream handle |
item | an item to unpack |
int(* WT_EXTENSION_API::unpack_start) (WT_EXTENSION_API *wt_api, WT_SESSION *session, const char *format, const void *buffer, size_t size, WT_PACK_STREAM **psp) |
Start an unpacking operation from a buffer.
See wiredtiger_unpack_start for details.
session | the session handle | |
format | the data format, see Packing and Unpacking Data | |
buffer | a pointer to memory holding the packed data | |
size | the size of the buffer | |
[out] | psp | the new packing stream handle |
int(* WT_EXTENSION_API::unpack_str) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, const char **sp) |
Unpack a string from a packing stream.
ps | the packing stream handle | |
[out] | sp | the unpacked string |
int(* WT_EXTENSION_API::unpack_uint) (WT_EXTENSION_API *wt_api, WT_PACK_STREAM *ps, uint64_t *up) |
Unpack an unsigned integer from a packing stream.
ps | the packing stream handle | |
[out] | up | the unpacked unsigned integer |
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 |