summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/docs/extensions.dox
blob: e6754eb93e8500dcd2e24ed788d2236d7e8d0069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*! @page extensions Extending WiredTiger

WiredTiger can be extended in various ways, including:

- adding @ref compression_custom, @ref encryption_custom,
- @ref custom_data_sources, and
- @ref WT_COLLATOR "by implementing the WT_COLLATOR interface".
- @ref WT_EXTRACTOR "by implementing the WT_EXTRACTOR interface".

Code that implements these interfaces can use the @ref wt_ext.

@section extensions_loadable Loadable extensions

Loadable extensions, also known as modules, are libraries of code that can
be loaded at runtime to add functionality to WiredTiger.  To build a
loadable extension, use <code>gcc -shared ...</code> or
<code>libtool -module ...</code>, or the equivalent for your system.

Extensions can be loaded on an open connection by calling
WT_CONNECTION::load_extension.

Extensions can be loaded during ::wiredtiger_open by passing the
\c extensions configuration when the database is created.  When used this
way, the extensions will be loaded each time the database is opened,
whether by your application or the @ref command_line.

The extension entry point, which defaults to ::wiredtiger_extension_init,
is called for each loadable module.  Applications must supply this entry
point, which in turn usually calls WT_CONNECTION::add_data_source,
WT_CONNECTION::add_encryptor, WT_CONNECTION::add_collator and/or
WT_CONNECTION::add_compressor to add functionality to WiredTiger.

@section extensions_recovery Extensions and recovery

Some extensions, in particular WT_COLLATOR and WT_COMPRESSOR, are required
in order to run recovery if \c logging is enabled.  This means that they
must be loaded using the \c extensions keyword to ::wiredtiger_open,
because recovery runs before ::wiredtiger_open returns the WT_CONNECTION
handle to the application.

@section extensions_local Local extensions

If it is not feasible to separate application logic into a loadable
extension separate from the executable, applications can use the reserved
name \c local as a path in the \c extensions list.  This will search for
the entry point in the running application, and should usually override the
\c entry symbol.

Here is an example of a local entry point:

<code>
wiredtiger_open(path, NULL,
    "create,extensions=[local=(entry=my_extension_init)]")
</code>

Note that databases created in this way can only be opened by applications
that include the specified entry point.  In particular, <b>they cannot be
accessed using the @ref command_line</b>.

 */