WiredTiger: WT_EXTRACTOR Struct Reference

| Version 3.1.0

Fork me on GitHub Join my user group
List of all members | Public Attributes
WT_EXTRACTOR Struct Reference
WiredTiger Extension API

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

  | extractor | the WT_EXTRACTOR implementation
  | session | the current WiredTiger session
  | key | the table key in raw format, see Raw mode for details
  | value | the table value in raw format, see Raw mode for details
  [out] | result_cursor | the 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.