kvs_fs.htm 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!DOCTYPE html><html><head><meta charset="utf-8" />
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  3. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  4. <meta name="description" content="" /><meta name="author" content="Maxim Sokhatsky" />
  5. <title>FS</title>
  6. <link rel="stylesheet" href="https://n2o.dev/blank.css" />
  7. <link rel="stylesheet" href="https://n2o.dev/zima.css" />
  8. </head><body><nav>
  9. <a href="https://n2o.dev">DEV</a>
  10. <a href="https://kvs.n2o.dev">KVS</a>
  11. <a href="#" style="background:#ededed;">FS</a>
  12. <div class="dropdown">
  13. <a onclick="drop()" class="dropbtn">EN</a>
  14. <div id="dropdown" class="dropdown-content">
  15. <a href="https://n2o.dev/ua/deps/kvs/man/kvs_fs.htm">UA</a>
  16. <a href="#">EN</a>
  17. </div>
  18. </div>
  19. </nav><header>
  20. <a href="../index.html"><img src="https://openmoji.org/data/color/svg/1F4BF.svg"/></a>
  21. <h1>FS</h1>
  22. </header>
  23. <main>
  24. <article>
  25. <section>
  26. <h3>INTRO</h3>
  27. <p>FS is a <b>filesystem</b> backend implementation for KVS.
  28. Put the {dba,kvs_fs} property for the kvs application in your sys.config.</p>
  29. <br />
  30. <h3>EXAMPLES</h3>
  31. <blockquote>All examples can be executed in Erlang REPL. Only
  32. requirement is to have kvs set in dependencies and kvs application
  33. started.</blockquote>
  34. <p>Create a new kvs_fs table called test. When executed, this
  35. function will create a new directory called test under data
  36. directory in the current workspace.</p>
  37. <figure><code>
  38. kvs_fs:create_table(test, []).
  39. % will return:
  40. % ok
  41. </code></figure>
  42. <p>Put a new key/value in table test. When executed, a new file is
  43. created under test directory. Its name is based on the sha1 of
  44. the key encoded in base64.</p>
  45. <figure><code>
  46. Table = test.
  47. Key = key.
  48. Value = <<"my_value">>.
  49. kvs_fs:put({test, Key, Value}).
  50. % will return:
  51. % ok
  52. </code></figure>
  53. <p>Get a key from value test.</p>
  54. <figure><code>
  55. kvs_fs:get(test, key).
  56. % will return:
  57. % {ok, {test, key, <<"my_value">>}}
  58. </code></figure>
  59. <p>Delete a key</p>
  60. </section>
  61. <section>
  62. <p>This module may refer to:
  63. <a href="kvs.htm"><b>kvs</b></a>.
  64. </p>
  65. </section>
  66. </article>
  67. </main><footer>
  68. 2005—2019 © Synrc Research Center
  69. </footer>
  70. <script>function drop(){document.getElementById("dropdown").classList.toggle("show");}</script>
  71. </body></html>