Version 1.1.5
WT_CURSOR_TYPE Struct Reference

Applications can extend WiredTiger by providing new implementations of the WT_CURSOR class. More...

List of all members.

Public Attributes

int(* cursor_size )(WT_CURSOR_TYPE *ctype, const char *obj, size_t *sizep)
 Callback to determine how much space to allocate for a cursor.
int(* init_cursor )(WT_CURSOR_TYPE *ctype, WT_SESSION *session, const char *obj, WT_CURSOR *old_cursor, const char *config, WT_CURSOR *new_cursor)
 Callback to initialize a cursor.

Detailed Description

Applications can extend WiredTiger by providing new implementations of the WT_CURSOR class.

Thread safety: WiredTiger may invoke methods on the WT_CURSOR_TYPE interface from multiple threads concurrently. It is the responsibility of the implementation to protect any shared data.

Applications register their implementation with WiredTiger by calling WT_CONNECTION::add_cursor_type.

        static WT_CURSOR_TYPE my_ctype = { my_cursor_size, my_init_cursor };
        ret = conn->add_cursor_type(conn, NULL, &my_ctype, NULL);
Examples:
ex_all.c.

Member Data Documentation

int(* WT_CURSOR_TYPE::cursor_size)(WT_CURSOR_TYPE *ctype, const char *obj, size_t *sizep)

Callback to determine how much space to allocate for a cursor.

If the callback is NULL, no additional space is allocated in the WT_CURSOR implementation.

Returns:
zero on success and a non-zero error code on failure. See Error Returns for details.
static int
my_cursor_size(WT_CURSOR_TYPE *ctype, const char *obj, size_t *sizep)
{
        (void)ctype;
        (void)obj;

        *sizep = sizeof (WT_CURSOR);
        return (0);
}
int(* WT_CURSOR_TYPE::init_cursor)(WT_CURSOR_TYPE *ctype, WT_SESSION *session, const char *obj, WT_CURSOR *old_cursor, const char *config, WT_CURSOR *new_cursor)

Callback to initialize a cursor.

static int
my_init_cursor(WT_CURSOR_TYPE *ctype, WT_SESSION *session,
    const char *obj, WT_CURSOR *old_cursor, const char *config,
    WT_CURSOR *new_cursor)
{
        /* Unused parameters */
        (void)ctype;
        (void)session;
        (void)obj;
        (void)old_cursor;
        (void)config;
        (void)new_cursor;

        return (0);
}