-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcustom_file_systems.html
94 lines (94 loc) · 9.31 KB
/
custom_file_systems.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
<!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: Custom File Systems</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('custom_file_systems.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">Custom File Systems </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Applications can provide a custom file system implementation that will be used by WiredTiger to interact with the I/O subsystem using the <a class="el" href="struct_w_t___f_i_l_e___s_y_s_t_e_m.html" title="The interface implemented by applications to provide a custom file system implementation. ">WT_FILE_SYSTEM</a> and <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html" title="A file handle implementation returned by WT_FILE_SYSTEM::open_file. ">WT_FILE_HANDLE</a> interfaces.</p>
<p>It is not necessary for all file system providers to implement all methods in the <a class="el" href="struct_w_t___f_i_l_e___s_y_s_t_e_m.html" title="The interface implemented by applications to provide a custom file system implementation. ">WT_FILE_SYSTEM</a> and <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html" title="A file handle implementation returned by WT_FILE_SYSTEM::open_file. ">WT_FILE_HANDLE</a> structures, and documentation for those structures indicate which methods are optional. Methods which are not provided should be set to NULL.</p>
<p>Function pointers should not be cleared once a handle is created. (WiredTiger might check for a non-NULL method and then call it, and clearing the function pointer could result in a core dump.)</p>
<p>Function pointers are not expected to be cleared or set after a handle is created. An exception to this are the file extension methods, because existing file system implementations do not know the level of support the underlying system provides until after file extension is attempted. For this reason, these methods appear in both locking and non-locking versions. Custom file systems needing to discover system support before configuring non-locking methods should initialize only the locking version of the method, then either set the non-locking version of the method and clear the locking method (or clear both methods), after discovery is complete. Clearing the method value is safe because calls are serialized until a non-locking method is set. Note it is not possible to downgrade from a non-locking version of these methods to a locking version.</p>
<p><a class="el" href="struct_w_t___f_i_l_e___s_y_s_t_e_m.html" title="The interface implemented by applications to provide a custom file system implementation. ">WT_FILE_SYSTEM</a> and <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html" title="A file handle implementation returned by WT_FILE_SYSTEM::open_file. ">WT_FILE_HANDLE</a> methods are expected to return POSIX 1003.1 or ANSI C standard error codes on failure. Custom file systems on Windows systems can use the <a class="el" href="struct_w_t___e_x_t_e_n_s_i_o_n___a_p_i.html#a638754053ec9ed74ded16e97b78849ca" title="Map a Windows system error code to a POSIX 1003.1/ANSI C error. ">WT_EXTENSION_API::map_windows_error</a> method to translate Windows system errors into POSIX system errors for return to WiredTiger.</p>
<p><a class="el" href="struct_w_t___f_i_l_e___s_y_s_t_e_m.html" title="The interface implemented by applications to provide a custom file system implementation. ">WT_FILE_SYSTEM</a> and <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html" title="A file handle implementation returned by WT_FILE_SYSTEM::open_file. ">WT_FILE_HANDLE</a> methods which fail, but where future calls may succeed (for example, a <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html#aadcd969865c263c9e9b00d39308e296c" title="Truncate the file. ">WT_FILE_HANDLE::fh_truncate</a> method call which fails because the file is currently mapped into memory), should return EBUSY.</p>
<p><a class="el" href="struct_w_t___f_i_l_e___s_y_s_t_e_m.html" title="The interface implemented by applications to provide a custom file system implementation. ">WT_FILE_SYSTEM</a> and <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html" title="A file handle implementation returned by WT_FILE_SYSTEM::open_file. ">WT_FILE_HANDLE</a> methods which fail, and no future calls will succeed, should return ENOTSUP. This failure may describe either the entire method being unavailable or a particular mode failure. For example, a <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html#a5b68b388279c64add7b0ef893b1d2e00" title="Indicate expected future use of file ranges, based on the POSIX 1003.1 standard fadvise. ">WT_FILE_HANDLE::fh_advise</a> method call with an argument of <a class="el" href="group__wt__ext.html#ga6d6c6913fd2d03910419f8e20f0026a4" title="WT_FILE_HANDLE::fadvise flags: no longer need. ">WT_FILE_HANDLE_DONTNEED</a>, where the file handle doesn't support the <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html#a5b68b388279c64add7b0ef893b1d2e00" title="Indicate expected future use of file ranges, based on the POSIX 1003.1 standard fadvise. ">WT_FILE_HANDLE::fh_advise</a> method at all, or only supports the method argument <a class="el" href="group__wt__ext.html#gaa4979ed3f2610368e392be059390b62f" title="WT_FILE_HANDLE::fadvise flags: will need. ">WT_FILE_HANDLE_WILLNEED</a>, should return ENOTSUP.</p>
<p>Additionally, custom file system functions may return <a class="el" href="group__wt.html#gaf4fc8744eb8fe4f1c6e125d0f2361992" title="WiredTiger library panic. ">WT_PANIC</a> to shut down the system.</p>
<p>Unless explicitly stated otherwise, WiredTiger may invoke methods on the <a class="el" href="struct_w_t___f_i_l_e___s_y_s_t_e_m.html" title="The interface implemented by applications to provide a custom file system implementation. ">WT_FILE_SYSTEM</a> and <a class="el" href="struct_w_t___f_i_l_e___h_a_n_d_l_e.html" title="A file handle implementation returned by WT_FILE_SYSTEM::open_file. ">WT_FILE_HANDLE</a> interfaces from multiple threads concurrently. It is the responsibility of the implementation to protect any shared data.</p>
<p>See <a class="el" href="ex_file_system_8c-example.html">ex_file_system.c</a> for an example implementation of a custom file system; the WiredTiger code for a POSIX standard file system is in the public domain and may also be useful as a starting point for a custom file system implementation. </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>