Version 10.0.2
WT_EXTRACTOR Struct Reference

The interface implemented by applications to provide custom extraction of index keys or column group values. More...

Public Attributes

int(* extract )(WT_EXTRACTOR *extractor, WT_SESSION *session, const WT_ITEM *key, const WT_ITEM *value, WT_CURSOR *result_cursor)
 Callback to extract a value for an index or column group. More...
 
int(* customize )(WT_EXTRACTOR *extractor, WT_SESSION *session, const char *uri, WT_CONFIG_ITEM *appcfg, WT_EXTRACTOR **customp)
 If non-NULL, this callback is called to customize the extractor for each index. More...
 
int(* terminate )(WT_EXTRACTOR *extractor, WT_SESSION *session)
 If non-NULL a callback performed when the index or column group is closed for customized extractors otherwise when the database is closed. More...
 

Detailed Description

The interface implemented by applications to provide custom extraction of index keys or column group values.

Applications register implementations with WiredTiger by calling WT_CONNECTION::add_extractor. See Custom Extractors for more information.

static WT_EXTRACTOR my_extractor = {my_extract, NULL, NULL};
error_check(conn->add_extractor(conn, "my_extractor", &my_extractor, NULL));
Examples
ex_extractor.c.

Member Data Documentation

◆ customize

int(* WT_EXTRACTOR::customize) (WT_EXTRACTOR *extractor, WT_SESSION *session, const char *uri, WT_CONFIG_ITEM *appcfg, WT_EXTRACTOR **customp)

If non-NULL, this callback is called to customize the extractor for each index.

If the callback returns a non-NULL extractor, that instance is used instead of this one for all comparisons.

◆ extract

int(* WT_EXTRACTOR::extract) (WT_EXTRACTOR *extractor, WT_SESSION *session, const WT_ITEM *key, const WT_ITEM *value, WT_CURSOR *result_cursor)

Callback to extract a value for an index or column group.

Returns
zero on success and a non-zero error code on failure. See Error handling for details.
static int
my_extract(WT_EXTRACTOR *extractor, WT_SESSION *session, const WT_ITEM *key, const WT_ITEM *value,
WT_CURSOR *result_cursor)
{
/* Unused parameters */
(void)extractor;
(void)session;
(void)key;
result_cursor->set_key(result_cursor, value);
return (result_cursor->insert(result_cursor));
}
Parameters
extractorthe WT_EXTRACTOR implementation
sessionthe current WiredTiger session
keythe table key in raw format, see Raw mode for details
valuethe table value in raw format, see Raw mode for details
[out]result_cursorthe method should call WT_CURSOR::set_key and WT_CURSOR::insert on this cursor to return a key. The key_format of the cursor will match that passed to WT_SESSION::create for the index. Multiple index keys can be created for each record by calling WT_CURSOR::insert multiple times.

◆ terminate

int(* WT_EXTRACTOR::terminate) (WT_EXTRACTOR *extractor, WT_SESSION *session)

If non-NULL a callback performed when the index or column group is closed for customized extractors otherwise when the database is closed.

The WT_EXTRACTOR::terminate callback is intended to allow cleanup, the handle will not be subsequently accessed by WiredTiger.

WT_CURSOR
A WT_CURSOR handle is the interface to a cursor.
Definition: wiredtiger.in:199
WT_CONNECTION::add_extractor
int add_extractor(WT_CONNECTION *connection, const char *name, WT_EXTRACTOR *extractor, const char *config)
Add a custom extractor for index keys or column groups.
WT_ITEM
A raw item of data to be managed, including a pointer to the data and a length.
Definition: wiredtiger.in:91
WT_EXTRACTOR
The interface implemented by applications to provide custom extraction of index keys or column group ...
Definition: wiredtiger.in:4405
WT_CURSOR::set_key
void set_key(WT_CURSOR *cursor,...)
Set the key for the next operation.
WT_SESSION
All data operations are performed in the context of a WT_SESSION.
Definition: wiredtiger.in:751
WT_CURSOR::insert
int insert(WT_CURSOR *cursor)
Insert a record and optionally update an existing record.