Current section

Files

Jump to
kvs man kvs_fs.htm
Raw

man/kvs_fs.htm

<!DOCTYPE html><html><head><meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" /><meta name="author" content="Maxim Sokhatsky" />
<title>FS</title>
<link rel="stylesheet" href="https://n2o.dev/blank.css" />
<link rel="stylesheet" href="https://n2o.dev/zima.css" />
</head><body><nav>
<a href="https://n2o.dev">DEV</a>
<a href="https://kvs.n2o.dev">KVS</a>
<a href="#" style="background:#ededed;">FS</a>
<div class="dropdown">
<a onclick="drop()" class="dropbtn">EN</a>
<div id="dropdown" class="dropdown-content">
<a href="https://n2o.dev/ua/deps/kvs/man/kvs_fs.htm">UA</a>
<a href="#">EN</a>
</div>
</div>
</nav><header>
<a href="../index.html"><img src="https://openmoji.org/data/color/svg/1F4BF.svg"/></a>
<h1>FS</h1>
</header>
<main>
<article>
<section>
<h3>INTRO</h3>
<p>FS is a <b>filesystem</b> backend implementation for KVS.
Put the {dba,kvs_fs} property for the kvs application in your sys.config.</p>
<br />
<h3>EXAMPLES</h3>
<blockquote>All examples can be executed in Erlang REPL. Only
requirement is to have kvs set in dependencies and kvs application
started.</blockquote>
<p>Create a new kvs_fs table called test. When executed, this
function will create a new directory called test under data
directory in the current workspace.</p>
<figure><code>
kvs_fs:create_table(test, []).
% will return:
% ok
</code></figure>
<p>Put a new key/value in table test. When executed, a new file is
created under test directory. Its name is based on the sha1 of
the key encoded in base64.</p>
<figure><code>
Table = test.
Key = key.
Value = <<"my_value">>.
kvs_fs:put({test, Key, Value}).
% will return:
% ok
</code></figure>
<p>Get a key from value test.</p>
<figure><code>
kvs_fs:get(test, key).
% will return:
% {ok, {test, key, <<"my_value">>}}
</code></figure>
<p>Delete a key</p>
</section>
<section>
<p>This module may refer to:
<a href="kvs.htm"><b>kvs</b></a>.
</p>
</section>
</article>
</main><footer>
2005—2019 © Synrc Research Center
</footer>
<script>function drop(){document.getElementById("dropdown").classList.toggle("show");}</script>
</body></html>