Version 1.3.0
WT_DATA_SOURCE Struct Reference

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

Public Attributes

int(* create )(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *name, int exclusive, const char *config)
 Callback to create a new object.
 
int(* drop )(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *name, const char *cfg[])
 Callback to drop an object.
 
int(* open_cursor )(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *obj, const char *cfg[], WT_CURSOR **new_cursor)
 Callback to initialize a cursor.
 
int(* rename )(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *oldname, const char *newname, const char *cfg[])
 Callback to rename an object.
 
int(* truncate )(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *name, const char *cfg[])
 Callback to truncate an object.
 

Detailed Description

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

Each data source supports a different URI scheme for data sources to WT_SESSION::create, WT_SESSION::open_cursor and related methods.

Thread safety: WiredTiger may invoke methods on the WT_DATA_SOURCE 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_data_source.

static WT_DATA_SOURCE my_dsrc = {
my_create,
my_drop,
my_open_cursor,
my_rename,
my_truncate
};
ret = conn->add_data_source(conn, "dsrc:", &my_dsrc, NULL);

Member Data Documentation

int(* WT_DATA_SOURCE::create)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *name, int exclusive, const char *config)

Callback to create a new object.

static int
my_create(WT_DATA_SOURCE *dsrc, WT_SESSION *session,
const char *name, int exclusive, const char *config)
{
/* Unused parameters */
(void)dsrc;
(void)session;
(void)name;
(void)exclusive;
(void)config;
return (0);
}
int(* WT_DATA_SOURCE::drop)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *name, const char *cfg[])

Callback to drop an object.

static int
my_drop(WT_DATA_SOURCE *dsrc, WT_SESSION *session,
const char *name, const char *cfg[])
{
/* Unused parameters */
(void)dsrc;
(void)session;
(void)name;
(void)cfg;
return (0);
}
int(* WT_DATA_SOURCE::open_cursor)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *obj, const char *cfg[], WT_CURSOR **new_cursor)

Callback to initialize a cursor.

static int
my_open_cursor(WT_DATA_SOURCE *dsrc, WT_SESSION *session,
const char *obj, const char *cfg[], WT_CURSOR **new_cursor)
{
/* Unused parameters */
(void)dsrc;
(void)session;
(void)obj;
(void)cfg;
(void)new_cursor;
return (0);
}
int(* WT_DATA_SOURCE::rename)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *oldname, const char *newname, const char *cfg[])

Callback to rename an object.

static int
my_rename(WT_DATA_SOURCE *dsrc, WT_SESSION *session,
const char *oldname, const char *newname, const char *cfg[])
{
/* Unused parameters */
(void)dsrc;
(void)session;
(void)oldname;
(void)newname;
(void)cfg;
return (0);
}
int(* WT_DATA_SOURCE::truncate)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, const char *name, const char *cfg[])

Callback to truncate an object.

static int
my_truncate(WT_DATA_SOURCE *dsrc, WT_SESSION *session,
const char *name, const char *cfg[])
{
/* Unused parameters */
(void)dsrc;
(void)session;
(void)name;
(void)cfg;
return (0);
}