-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathextensions.html
107 lines (107 loc) · 7.9 KB
/
extensions.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>WiredTiger: Extending WiredTiger</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="wiredtiger.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><a href="http://wiredtiger.com/"><img alt="Logo" src="LogoFinal-header.png" alt="WiredTiger" /></a></td>
<td style="padding-left: 0.5em;">
<div id="projectname">
 <span id="projectnumber">Version 2.9.2</span>
</div>
<div id="projectbrief"><!-- 2.9.2 --></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="banner">
<a href="https://github.com/wiredtiger/wiredtiger">Fork me on GitHub</a>
<a class="last" href="http://groups.google.com/group/wiredtiger-users">Join my user group</a>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li><a href="community.html"><span>Community</span></a></li>
<li><a href="license.html"><span>License</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('extensions.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">Extending WiredTiger </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>WiredTiger can be extended in various ways, including:</p>
<ul>
<li>adding <a class="el" href="compression.html#compression_custom">Custom compression engines</a>, <a class="el" href="encryption.html#encryption_custom">Custom encryption engines</a>,</li>
<li><a class="el" href="custom_data_sources.html">Custom Data Sources</a>, and</li>
<li><a class="el" href="struct_w_t___c_o_l_l_a_t_o_r.html">by implementing the WT_COLLATOR interface</a>.</li>
<li><a class="el" href="struct_w_t___e_x_t_r_a_c_t_o_r.html">by implementing the WT_EXTRACTOR interface</a>.</li>
</ul>
<p>Code that implements these interfaces can use the <a class="el" href="group__wt__ext.html">WiredTiger Extension API</a>.</p>
<h1><a class="anchor" id="extensions_loadable"></a>
Loadable extensions</h1>
<p>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.</p>
<p>Extensions can be loaded on an open connection by calling <a class="el" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html#ab6a56facfd217e5ff687aa4c012e8d68" title="Load an extension. ">WT_CONNECTION::load_extension</a>.</p>
<p>Extensions can be loaded during <a class="el" href="group__wt.html#ga9e6adae3fc6964ef837a62795c7840ed" title="Open a connection to a database. ">wiredtiger_open</a> by passing the <code>extensions</code> 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 <a class="el" href="command_line.html">WiredTiger command line utility</a>.</p>
<p>The extension entry point, which defaults to <a class="el" href="group__wt__ext.html#ga5ed14c916d5dcfe0e81aea9d9ccb7fe3" title="Entry point to an extension, called when the extension is loaded. ">wiredtiger_extension_init</a>, is called for each loadable module. Applications must supply this entry point, which in turn usually calls <a class="el" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html#a459c1b71346bbcecb552ad73d43f27ea" title="Add a custom data source. ">WT_CONNECTION::add_data_source</a>, <a class="el" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html#a59d203f4474780ca34bd3e07b8064949" title="Add an encryption function. ">WT_CONNECTION::add_encryptor</a>, <a class="el" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html#a89290382c55f20e5a4e1bc9216c7a8c8" title="Add a custom collation function. ">WT_CONNECTION::add_collator</a> and/or <a class="el" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html#a4f26bfa799ae5e72b536ac93d6200783" title="Add a compression function. ">WT_CONNECTION::add_compressor</a> to add functionality to WiredTiger.</p>
<h1><a class="anchor" id="extensions_recovery"></a>
Extensions and recovery</h1>
<p>Some extensions, in particular <a class="el" href="struct_w_t___c_o_l_l_a_t_o_r.html" title="The interface implemented by applications to provide custom ordering of records. ">WT_COLLATOR</a> and <a class="el" href="struct_w_t___c_o_m_p_r_e_s_s_o_r.html" title="The interface implemented by applications to provide custom compression. ">WT_COMPRESSOR</a>, are required in order to run recovery if <code>logging</code> is enabled. This means that they must be loaded using the <code>extensions</code> keyword to <a class="el" href="group__wt.html#ga9e6adae3fc6964ef837a62795c7840ed" title="Open a connection to a database. ">wiredtiger_open</a>, because recovery runs before <a class="el" href="group__wt.html#ga9e6adae3fc6964ef837a62795c7840ed" title="Open a connection to a database. ">wiredtiger_open</a> returns the <a class="el" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html" title="A connection to a WiredTiger database. ">WT_CONNECTION</a> handle to the application.</p>
<h1><a class="anchor" id="extensions_local"></a>
Local extensions</h1>
<p>If it is not feasible to separate application logic into a loadable extension separate from the executable, applications can use the reserved name <code>local</code> as a path in the <code>extensions</code> list. This will search for the entry point in the running application, and should usually override the <code>entry</code> symbol.</p>
<p>Here is an example of a local entry point:</p>
<p><code> wiredtiger_open(path, NULL, "create,extensions=[local=(entry=my_extension_init)]") </code></p>
<p>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 <a class="el" href="command_line.html">WiredTiger command line utility</a></b>. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="index.html">Reference Guide</a></li><li class="navelem"><a class="el" href="programming.html">Writing WiredTiger applications</a></li>
<li class="footer">Copyright (c) 2008-2016 MongoDB, Inc. All rights reserved. Contact <a href="mailto:[email protected]">[email protected]</a> for more information.</li>
</ul>
</div>
</body>
</html>