Version 2.8.0
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};
ret = conn->add_extractor(conn, "my_extractor", &my_extractor, NULL);
Examples:
ex_extractor.c.

Member Data Documentation

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.

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