/usr/share/doc/ocsigenserver/api-html/Ocsipersist.html is in ocsigenserver-doc 2.2.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Authbasic.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Ocsigen_cache" rel="Chapter" href="Ocsigen_cache.html">
<link title="Ocsigen_lib_base" rel="Chapter" href="Ocsigen_lib_base.html">
<link title="Ocsigen_lib" rel="Chapter" href="Ocsigen_lib.html">
<link title="Ocsigen_config" rel="Chapter" href="Ocsigen_config.html">
<link title="Ocsigen_getcommandline" rel="Chapter" href="Ocsigen_getcommandline.html">
<link title="Ocsigen_messages" rel="Chapter" href="Ocsigen_messages.html">
<link title="Ocsigen_stream" rel="Chapter" href="Ocsigen_stream.html">
<link title="Ocsigen_loader" rel="Chapter" href="Ocsigen_loader.html">
<link title="Polytables" rel="Chapter" href="Polytables.html">
<link title="Http_headers" rel="Chapter" href="Http_headers.html">
<link title="Ocsigen_http_frame" rel="Chapter" href="Ocsigen_http_frame.html">
<link title="Ocsigen_headers" rel="Chapter" href="Ocsigen_headers.html">
<link title="Framepp" rel="Chapter" href="Framepp.html">
<link title="Ocsigen_http_com" rel="Chapter" href="Ocsigen_http_com.html">
<link title="Ocsigen_charset_mime" rel="Chapter" href="Ocsigen_charset_mime.html">
<link title="Ocsigen_senders" rel="Chapter" href="Ocsigen_senders.html">
<link title="Ocsigen_cookies" rel="Chapter" href="Ocsigen_cookies.html">
<link title="Ocsigen_extensions" rel="Chapter" href="Ocsigen_extensions.html">
<link title="Ocsigen_parseconfig" rel="Chapter" href="Ocsigen_parseconfig.html">
<link title="Ocsigen_http_client" rel="Chapter" href="Ocsigen_http_client.html">
<link title="Ocsigen_local_files" rel="Chapter" href="Ocsigen_local_files.html">
<link title="Ocsigen_server" rel="Chapter" href="Ocsigen_server.html">
<link title="Ocsigen_comet" rel="Chapter" href="Ocsigen_comet.html">
<link title="Accesscontrol" rel="Chapter" href="Accesscontrol.html">
<link title="Authbasic" rel="Chapter" href="Authbasic.html">
<link title="Ocsipersist" rel="Chapter" href="Ocsipersist.html"><link title="Persistent references" rel="Section" href="#2_Persistentreferences">
<link title="Persistent tables" rel="Section" href="#2_Persistenttables">
<title>Ocsipersist</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Authbasic.html" title="Authbasic">Previous</a>
<a class="up" href="index.html" title="Index">Up</a>
</div>
<h1>Module <a href="type_Ocsipersist.html">Ocsipersist</a></h1>
<pre><span class="keyword">module</span> Ocsipersist: <code class="code">sig</code> <a href="Ocsipersist.html">..</a> <code class="code">end</code></pre><div class="info module top">
Persistent data on hard disk.<br>
</div>
<hr width="100%">
<br>
There are currently two implementations of this module,
one using a DBM database, and the other using SQLITE.
Link the one your want with your program.<br>
<br>
<h2 id="2_Persistentreferences">Persistent references</h2><br>
<br>
When launching the program, if the value exists on hard disk,
it is loaded, otherwise it is initialised to the default value<br>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> </pre>
<div class="info ">
Type of persistent data<br>
</div>
<pre><span id="TYPEstore"><span class="keyword">type</span> <code class="type"></code>store</span> </pre>
<div class="info ">
Data are divided into stores.
Create one store for your project, where you will save all your data.<br>
</div>
<pre><span id="VALopen_store"><span class="keyword">val</span> open_store</span> : <code class="type">string -> <a href="Ocsipersist.html#TYPEstore">store</a></code></pre><div class="info ">
Open a store (and create it if it does not exist)<br>
</div>
<pre><span id="VALmake_persistent"><span class="keyword">val</span> make_persistent</span> : <code class="type">store:<a href="Ocsipersist.html#TYPEstore">store</a> -><br> name:string -> default:'a -> 'a <a href="Ocsipersist.html#TYPEt">t</a> Lwt.t</code></pre><div class="info ">
<code class="code">make_persistent store name default</code> find a persistent value
named <code class="code">name</code> in store <code class="code">store</code>
from database, or create it with the default value <code class="code">default</code> if it
does not exist.<br>
</div>
<pre><span id="VALmake_persistent_lazy"><span class="keyword">val</span> make_persistent_lazy</span> : <code class="type">store:<a href="Ocsipersist.html#TYPEstore">store</a> -><br> name:string -> default:(unit -> 'a) -> 'a <a href="Ocsipersist.html#TYPEt">t</a> Lwt.t</code></pre><div class="info ">
Same as make_persistent but the default value is evaluated only
if needed<br>
</div>
<pre><span id="VALget"><span class="keyword">val</span> get</span> : <code class="type">'a <a href="Ocsipersist.html#TYPEt">t</a> -> 'a Lwt.t</code></pre><div class="info ">
<code class="code">get pv</code> gives the value of <code class="code">pv</code><br>
</div>
<pre><span id="VALset"><span class="keyword">val</span> set</span> : <code class="type">'a <a href="Ocsipersist.html#TYPEt">t</a> -> 'a -> unit Lwt.t</code></pre><div class="info ">
<code class="code">set pv value</code> sets a persistent value <code class="code">pv</code> to <code class="code">value</code><br>
</div>
<br>
<h2 id="2_Persistenttables">Persistent tables</h2><br>
<pre><span id="TYPEtable"><span class="keyword">type</span> <code class="type">'value</code> table</span> </pre>
<div class="info ">
Type of persistent table<br>
</div>
<pre><span id="VALtable_name"><span class="keyword">val</span> table_name</span> : <code class="type">'value <a href="Ocsipersist.html#TYPEtable">table</a> -> string Lwt.t</code></pre><div class="info ">
returns the name of the table<br>
</div>
<pre><span id="VALopen_table"><span class="keyword">val</span> open_table</span> : <code class="type">string -> 'value <a href="Ocsipersist.html#TYPEtable">table</a></code></pre><div class="info ">
Open a table (and create it if it does not exist)<br>
</div>
<pre><span id="VALfind"><span class="keyword">val</span> find</span> : <code class="type">'value <a href="Ocsipersist.html#TYPEtable">table</a> -> string -> 'value Lwt.t</code></pre><div class="info ">
<code class="code">find table key</code> gives the value associated to <code class="code">key</code>.
Fails with <code class="code">Not_found</code> if not found.<br>
</div>
<pre><span id="VALadd"><span class="keyword">val</span> add</span> : <code class="type">'value <a href="Ocsipersist.html#TYPEtable">table</a> -> string -> 'value -> unit Lwt.t</code></pre><div class="info ">
<code class="code">add table key value</code> associates <code class="code">value</code> to <code class="code">key</code>.
If the database already contains data associated with <code class="code">key</code>,
that data is discarded and silently replaced by the new data.<br>
</div>
<pre><span id="VALreplace_if_exists"><span class="keyword">val</span> replace_if_exists</span> : <code class="type">'value <a href="Ocsipersist.html#TYPEtable">table</a> -> string -> 'value -> unit Lwt.t</code></pre><div class="info ">
<code class="code">replace_if_exists table key value</code>
associates <code class="code">value</code> to <code class="code">key</code> only if <code class="code">key</code> is already bound.
If the database does not contain any data associated with <code class="code">key</code>,
fails with <code class="code">Not_found</code>.<br>
</div>
<pre><span id="VALremove"><span class="keyword">val</span> remove</span> : <code class="type">'value <a href="Ocsipersist.html#TYPEtable">table</a> -> string -> unit Lwt.t</code></pre><div class="info ">
<code class="code">remove table key</code> removes the entry in the table if it exists<br>
</div>
<pre><span id="VALlength"><span class="keyword">val</span> length</span> : <code class="type">'value <a href="Ocsipersist.html#TYPEtable">table</a> -> int Lwt.t</code></pre><div class="info ">
Size of a table.<br>
</div>
<pre><span id="VALiter_step"><span class="keyword">val</span> iter_step</span> : <code class="type">(string -> 'a -> unit Lwt.t) -> 'a <a href="Ocsipersist.html#TYPEtable">table</a> -> unit Lwt.t</code></pre><div class="info ">
Important warning: this iterator may not iter on all data of the table
if another thread is modifying it in the same time. Nonetheless, it should
not miss more than a very few data from time to time, except if the table
is very old (at least 9 223 372 036 854 775 807 insertions).<br>
</div>
<pre><span id="VALiter_table"><span class="keyword">val</span> iter_table</span> : <code class="type">(string -> 'a -> unit Lwt.t) -> 'a <a href="Ocsipersist.html#TYPEtable">table</a> -> unit Lwt.t</code></pre><div class="info ">
Legacy interface for iter_step<br>
</div>
<pre><span id="VALfold_step"><span class="keyword">val</span> fold_step</span> : <code class="type">(string -> 'a -> 'b -> 'b Lwt.t) -> 'a <a href="Ocsipersist.html#TYPEtable">table</a> -> 'b -> 'b Lwt.t</code></pre><div class="info ">
Important warning: this iterator may not iter on all data of the table
if another thread is modifying it in the same time. Nonetheless, it should
not miss more than a very few data from time to time, except if the table
is very old (at least 9 223 372 036 854 775 807 insertions).<br>
</div>
<pre><span id="VALfold_table"><span class="keyword">val</span> fold_table</span> : <code class="type">(string -> 'a -> 'b -> 'b Lwt.t) -> 'a <a href="Ocsipersist.html#TYPEtable">table</a> -> 'b -> 'b Lwt.t</code></pre><div class="info ">
Legacy interface for fold_step<br>
</div>
</body></html>
|