Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial commit

  • Loading branch information...
commit 894315351253f6d8aac95a2e465c2f0540fdfb1d 0 parents
Joseph Wayne Norton authored
2  .gitignore
... ... @@ -0,0 +1,2 @@
  1 +.test/
  2 +ebin/
21 LICENSE
... ... @@ -0,0 +1,21 @@
  1 +The MIT License
  2 +
  3 +Copyright (C) 2011-2012 by Joseph Wayne Norton <norton@alum.mit.edu>
  4 +
  5 +Permission is hereby granted, free of charge, to any person obtaining a copy
  6 +of this software and associated documentation files (the "Software"), to deal
  7 +in the Software without restriction, including without limitation the rights
  8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9 +copies of the Software, and to permit persons to whom the Software is
  10 +furnished to do so, subject to the following conditions:
  11 +
  12 +The above copyright notice and this permission notice shall be included in
  13 +all copies or substantial portions of the Software.
  14 +
  15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21 +THE SOFTWARE.
677 README.md
Source Rendered
... ... @@ -0,0 +1,677 @@
  1 +
  2 +
  3 +#GEN_ETS - GEN(eric) Erlang Term Storage#
  4 +
  5 +
  6 +Copyright (c) 2011-2012 by Joseph Wayne Norton
  7 +
  8 +__Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)).<p>GEN_ETS is an generic wrapper for Erlang Term Storage with a callback
  9 +interface for a backend implementation.</p>
  10 +<p>For testing purposes, GEN_ETS supports a default backend
  11 +implementation:</p>
  12 +<ul>
  13 +<li>
  14 +<p>
  15 +<tt>ets</tt> Erlang ETS backend
  16 +</p>
  17 +</li>
  18 +</ul>
  19 +<p>GEN_ETS is not intended to be an exact clone of ETS. The currently
  20 +supported ETS APIs are:</p>
  21 +<ul>
  22 +<li>
  23 +<p>
  24 +<tt>all/0</tt>
  25 +</p>
  26 +</li>
  27 +<li>
  28 +<p>
  29 +<tt>delete/1</tt>
  30 +</p>
  31 +</li>
  32 +<li>
  33 +<p>
  34 +<tt>delete/2</tt>
  35 +</p>
  36 +</li>
  37 +<li>
  38 +<p>
  39 +<tt>delete_all_objects/1</tt>
  40 +</p>
  41 +</li>
  42 +<li>
  43 +<p>
  44 +<tt>first/1</tt>
  45 +</p>
  46 +</li>
  47 +<li>
  48 +<p>
  49 +<tt>foldl/3</tt>
  50 +</p>
  51 +</li>
  52 +<li>
  53 +<p>
  54 +<tt>foldr/3</tt>
  55 +</p>
  56 +</li>
  57 +<li>
  58 +<p>
  59 +<tt>info/1</tt> <em>only a subset of items</em>
  60 +</p>
  61 +</li>
  62 +<li>
  63 +<p>
  64 +<tt>info/2</tt> <em>only a subset of items</em>
  65 +</p>
  66 +</li>
  67 +<li>
  68 +<p>
  69 +<tt>insert/2</tt>
  70 +</p>
  71 +</li>
  72 +<li>
  73 +<p>
  74 +<tt>insert_new/2</tt>
  75 +</p>
  76 +</li>
  77 +<li>
  78 +<p>
  79 +<tt>last/1</tt>
  80 +</p>
  81 +</li>
  82 +<li>
  83 +<p>
  84 +<tt>lookup/2</tt>
  85 +</p>
  86 +</li>
  87 +<li>
  88 +<p>
  89 +<tt>lookup_element/3</tt>
  90 +</p>
  91 +</li>
  92 +<li>
  93 +<p>
  94 +<tt>match/1</tt>
  95 +</p>
  96 +</li>
  97 +<li>
  98 +<p>
  99 +<tt>match/2</tt>
  100 +</p>
  101 +</li>
  102 +<li>
  103 +<p>
  104 +<tt>match/3</tt>
  105 +</p>
  106 +</li>
  107 +<li>
  108 +<p>
  109 +<tt>match_delete/2</tt>
  110 +</p>
  111 +</li>
  112 +<li>
  113 +<p>
  114 +<tt>match_object/1</tt>
  115 +</p>
  116 +</li>
  117 +<li>
  118 +<p>
  119 +<tt>match_object/2</tt>
  120 +</p>
  121 +</li>
  122 +<li>
  123 +<p>
  124 +<tt>match_object/3</tt>
  125 +</p>
  126 +</li>
  127 +<li>
  128 +<p>
  129 +<tt>member/2</tt>
  130 +</p>
  131 +</li>
  132 +<li>
  133 +<p>
  134 +<tt>new/2</tt>
  135 +</p>
  136 +</li>
  137 +<li>
  138 +<p>
  139 +<tt>next/2</tt>
  140 +</p>
  141 +</li>
  142 +<li>
  143 +<p>
  144 +<tt>prev/2</tt>
  145 +</p>
  146 +</li>
  147 +<li>
  148 +<p>
  149 +<tt>select/1</tt>
  150 +</p>
  151 +</li>
  152 +<li>
  153 +<p>
  154 +<tt>select/2</tt>
  155 +</p>
  156 +</li>
  157 +<li>
  158 +<p>
  159 +<tt>select/3</tt>
  160 +</p>
  161 +</li>
  162 +<li>
  163 +<p>
  164 +<tt>select_count/2</tt>
  165 +</p>
  166 +</li>
  167 +<li>
  168 +<p>
  169 +<tt>select_delete/2</tt>
  170 +</p>
  171 +</li>
  172 +<li>
  173 +<p>
  174 +<tt>select_reverse/1</tt>
  175 +</p>
  176 +</li>
  177 +<li>
  178 +<p>
  179 +<tt>select_reverse/2</tt>
  180 +</p>
  181 +</li>
  182 +<li>
  183 +<p>
  184 +<tt>select_reverse/3</tt>
  185 +</p>
  186 +</li>
  187 +<li>
  188 +<p>
  189 +<tt>tab2list/1</tt>
  190 +</p>
  191 +</li>
  192 +</ul>
  193 +<p><em>This repository is experimental in nature - use at your own risk and
  194 +please contribute if you find GEN_ETS useful.</em></p>
  195 +
  196 +<h2 id="_quick_start_recipe">Quick Start Recipe</h2>
  197 +
  198 +<p>To download and build the gen_ets application in one shot, please follow
  199 +this recipe:</p>
  200 +
  201 +
  202 +<pre><tt>$ mkdir working-directory-name
  203 +$ cd working-directory-name
  204 +$ git clone https://github.com/norton/gen_ets.git gen_ets
  205 +$ cd gen_ets
  206 +$ ./rebar get-deps
  207 +$ ./rebar clean
  208 +$ ./rebar compile</tt></pre>
  209 +
  210 +<p><em>OR</em> if QuickCheck is available then follow the this recipe:</p>
  211 +
  212 +
  213 +<pre><tt>$ mkdir working-directory-name
  214 +$ cd working-directory-name
  215 +$ git clone https://github.com/norton/gen_ets.git gen_ets
  216 +$ cd gen_ets
  217 +$ ./rebar get-deps
  218 +$ ./rebar clean
  219 +$ ./rebar compile -D QC -D QC_EQC
  220 +$ ./rebar test-compile -D QC -D QC_EQC
  221 +$ (cd .test; erl -smp +A 5 -pz ../../qc/ebin)
  222 +
  223 +1> qc_statem_gen_ets:qc_run(500, []).
  224 + :
  225 + :
  226 +OK, passed 500 tests
  227 +
  228 +100.0% {1,attempts}
  229 +
  230 +7.11% {delete,ok}
  231 +6.78% {new,ok}
  232 +3.91% {insert_new,ok}
  233 +3.83% {select_reverse31,ok}
  234 +3.76% {select31,ok}
  235 +3.69% {tab2list,ok}
  236 +3.69% {match31,ok}
  237 +3.69% {first,ok}
  238 +3.67% {delete_all_objects,ok}
  239 +3.66% {foldl,ok}
  240 +3.63% {select,ok}
  241 +3.63% {member,ok}
  242 +3.61% {select_count,ok}
  243 +3.61% {last,ok}
  244 +3.61% {foldr,ok}
  245 +3.57% {insert,ok}
  246 +3.50% {match_object31,ok}
  247 +3.49% {match_delete,ok}
  248 +3.44% {lookup,ok}
  249 +3.42% {select_delete,ok}
  250 +3.36% {match_object,ok}
  251 +3.34% {select_reverse,ok}
  252 +3.19% {match,ok}
  253 +2.92% {lookup_element,{error,badarg}}
  254 +2.17% {prev,ok}
  255 +1.88% {next,ok}
  256 +1.57% {next,{error,badarg}}
  257 +1.56% {prev,{error,badarg}}
  258 +0.72% {lookup_element,ok}
  259 +true</tt></pre>
  260 +
  261 +<p>For an alternative recipe with other "features" albeit more complex,
  262 +please read further.</p>
  263 +
  264 +
  265 +
  266 +<h2 id="_documentation">Documentation</h2>
  267 +
  268 +
  269 +<h3 id="_where_should_i_start">Where should I start?</h3>
  270 +<p>This README is the only bit of documentation right now.</p>
  271 +<p>The QC (a.k.a. QuickCheck, PropEr, etc.) tests underneath the
  272 +"tests/qc" directory should be helpful for understanding the
  273 +specification and behavior of ETS and GEN_ETS. NIF-based
  274 +implementations.</p>
  275 +
  276 +
  277 +<h3 id="_what_is_ets_and_dets">What is ETS and DETS?</h3>
  278 +<p>ETS and DETS are Erlang/OTP's standard library modules for Erlang
  279 +term storage. ETS is a memory-based implementation. DETS is a
  280 +disk-based implementation.</p>
  281 +<p>See <a href="http://www.erlang.org/doc/man/ets.html">http://www.erlang.org/doc/man/ets.html</a> and
  282 +<a href="http://www.erlang.org/doc/man/dets.html">http://www.erlang.org/doc/man/dets.html</a> for further details.</p>
  283 +
  284 +
  285 +
  286 +
  287 +<h2 id="_to_download">To download</h2>
  288 +
  289 +<ol class="arabic">
  290 +<li>
  291 +<p>
  292 +Configure your e-mail and name for Git
  293 +</p>
  294 +
  295 +
  296 +<pre><tt>$ git config \--global user.email "you@example.com"
  297 +$ git config \--global user.name "Your Name"</tt></pre>
  298 +
  299 +</li>
  300 +<li>
  301 +<p>
  302 +Install Repo
  303 +</p>
  304 +
  305 +
  306 +<pre><tt>$ mkdir -p ~/bin
  307 +$ wget -O - https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
  308 +$ chmod a+x ~/bin/repo</tt></pre>
  309 +
  310 +</li>
  311 +<li>
  312 +<p>
  313 +Create working directory
  314 +</p>
  315 +
  316 +
  317 +<pre><tt>$ mkdir working-directory-name
  318 +$ cd working-directory-name
  319 +$ repo init -u https://github.com/norton/manifests.git -m gen_ets-default.xml</tt></pre>
  320 +
  321 +
  322 +<table><tr>
  323 +<td class="icon">
  324 +Note
  325 +</td>
  326 +<td class="content">Your "Git" identity is needed during the init step. Please
  327 +enter the name and email of your GitHub account if you have one. Team
  328 +members having read-write access are recommended to use "repo init -u
  329 +<a href="mailto:git@github.com">git@github.com</a>:norton/manifests.git -m gen_ets-default-rw.xml".</td>
  330 +</tr></table>
  331 +
  332 +
  333 +<table><tr>
  334 +<td class="icon">
  335 +Tip
  336 +</td>
  337 +<td class="content">If you want to checkout the latest development version, please
  338 +append " -b dev" to the repo init command.</td>
  339 +</tr></table>
  340 +
  341 +</li>
  342 +<li>
  343 +<p>
  344 +Download Git repositories
  345 +</p>
  346 +
  347 +
  348 +<pre><tt>$ cd working-directory-name
  349 +$ repo sync</tt></pre>
  350 +
  351 +</li>
  352 +</ol>
  353 +<p>For futher information and help for related tools, please refer to the
  354 +following links:</p>
  355 +<ul>
  356 +<li>
  357 +<p>
  358 +Erlang - <a href="http://www.erlang.org/">http://www.erlang.org/</a>
  359 +</p>
  360 +<ul>
  361 +<li>
  362 +<p>
  363 +<strong>R14 or newer, R15B02 has been tested recently</strong>
  364 +</p>
  365 +</li>
  366 +</ul>
  367 +</li>
  368 +<li>
  369 +<p>
  370 +Git - <a href="http://git-scm.com/">http://git-scm.com/</a>
  371 +</p>
  372 +<ul>
  373 +<li>
  374 +<p>
  375 +<strong>Git 1.5.4 or newer, Git 1.7.12 has been tested recently</strong>
  376 +</p>
  377 +</li>
  378 +<li>
  379 +<p>
  380 +<em>required for Repo and GitHub</em>
  381 +</p>
  382 +</li>
  383 +</ul>
  384 +</li>
  385 +<li>
  386 +<p>
  387 +GitHub - <a href="https://github.com">https://github.com</a>
  388 +</p>
  389 +</li>
  390 +<li>
  391 +<p>
  392 +Python - <a href="http://www.python.org">http://www.python.org</a>
  393 +</p>
  394 +<ul>
  395 +<li>
  396 +<p>
  397 +<strong>Python 2.4 or newer, Python 2.7.2 has been tested recently
  398 + (CAUTION: Python 3.x might be too new)</strong>
  399 +</p>
  400 +</li>
  401 +<li>
  402 +<p>
  403 +<em>required for Repo</em>
  404 +</p>
  405 +</li>
  406 +</ul>
  407 +</li>
  408 +<li>
  409 +<p>
  410 +Rebar - <a href="https://github.com/basho/rebar/wiki">https://github.com/basho/rebar/wiki</a>
  411 +</p>
  412 +</li>
  413 +<li>
  414 +<p>
  415 +Repo - <a href="http://source.android.com/source/git-repo.md">http://source.android.com/source/git-repo.html</a>
  416 +</p>
  417 +</li>
  418 +</ul>
  419 +
  420 +
  421 +
  422 +<h2 id="_to_build_basic_recipe">To build - basic recipe</h2>
  423 +
  424 +<ol class="arabic">
  425 +<li>
  426 +<p>
  427 +Get and install an erlang system <a href="http://www.erlang.org">http://www.erlang.org</a>
  428 +</p>
  429 +</li>
  430 +<li>
  431 +<p>
  432 +Build
  433 +</p>
  434 +
  435 +
  436 +<pre><tt>$ cd working-directory-name
  437 +$ make compile</tt></pre>
  438 +
  439 +</li>
  440 +</ol>
  441 +
  442 +
  443 +
  444 +<h2 id="_to_build_optional_features">To build - optional features</h2>
  445 +
  446 +<ol class="upperalpha">
  447 +<li>
  448 +<p>
  449 +Dialyzer Testing <em>basic recipe</em>
  450 +</p>
  451 +<ol class="arabic">
  452 +<li>
  453 +<p>
  454 +Build Dialyzer's PLT <em>(required once)</em>
  455 +</p>
  456 +
  457 +
  458 +<pre><tt>$ cd working-directory-name
  459 +$ make build-plt</tt></pre>
  460 +
  461 +
  462 +<table><tr>
  463 +<td class="icon">
  464 +Tip
  465 +</td>
  466 +<td class="content">Check Makefile and dialyzer's documentation for further
  467 +information.</td>
  468 +</tr></table>
  469 +
  470 +</li>
  471 +<li>
  472 +<p>
  473 +Dialyze with specs
  474 +</p>
  475 +
  476 +
  477 +<pre><tt>$ cd working-directory-name
  478 +$ make dialyze</tt></pre>
  479 +
  480 +
  481 +<table><tr>
  482 +<td class="icon">
  483 +Caution
  484 +</td>
  485 +<td class="content">If you manually run dialyzer with the "-r" option, execute
  486 +"make clean compile" first to avoid finding duplicate beam files
  487 +underneath rebar's .test directory. Check Makefile for further
  488 +information.</td>
  489 +</tr></table>
  490 +
  491 +</li>
  492 +<li>
  493 +<p>
  494 +Dialyze without specs
  495 +</p>
  496 +
  497 +
  498 +<pre><tt>$ cd working-directory-name
  499 +$ make dialyze-nospec</tt></pre>
  500 +
  501 +</li>
  502 +</ol>
  503 +</li>
  504 +</ol>
  505 +
  506 +
  507 +
  508 +<h2 id="_to_test_quickcheck">To test - QuickCheck</h2>
  509 +
  510 +<ol class="arabic">
  511 +<li>
  512 +<p>
  513 +Make sure QuickCheck is in your Erlang code path. One simple way
  514 + to accomplish this is by adding the code path to your <tt>~/.erlang</tt>
  515 + resource file.
  516 +</p>
  517 +
  518 +
  519 +<pre><tt>true = code:add_pathz(os:getenv("HOME")++"/.erlang.d/deps/quviq/eqc-X.Y.Z/ebin").</tt></pre>
  520 +
  521 +</li>
  522 +<li>
  523 +<p>
  524 +Compile for QuickCheck
  525 +</p>
  526 +
  527 +
  528 +<pre><tt>$ cd working-directory-name
  529 +$ make clean
  530 +$ make eqc-compile</tt></pre>
  531 +
  532 +</li>
  533 +<li>
  534 +<p>
  535 +Run 5,000 QuickCheck tests
  536 +</p>
  537 +
  538 +
  539 +<pre><tt>$ cd working-directory-name/deps/gen_ets/.test
  540 +$ erl -smp +A 5 -pz -pz ../../qc/ebin
  541 +
  542 +1> qc_statem_gen_ets:qc_run(5000).
  543 +....
  544 +OK, passed 5000 tests
  545 +
  546 +100.0% {1,attempts}
  547 +
  548 +7.11% {delete,ok}
  549 +6.78% {new,ok}
  550 +3.91% {insert_new,ok}
  551 +3.83% {select_reverse31,ok}
  552 +3.76% {select31,ok}
  553 +3.69% {tab2list,ok}
  554 +3.69% {match31,ok}
  555 +3.69% {first,ok}
  556 +3.67% {delete_all_objects,ok}
  557 +3.66% {foldl,ok}
  558 +3.63% {select,ok}
  559 +3.63% {member,ok}
  560 +3.61% {select_count,ok}
  561 +3.61% {last,ok}
  562 +3.61% {foldr,ok}
  563 +3.57% {insert,ok}
  564 +3.50% {match_object31,ok}
  565 +3.49% {match_delete,ok}
  566 +3.44% {lookup,ok}
  567 +3.42% {select_delete,ok}
  568 +3.36% {match_object,ok}
  569 +3.34% {select_reverse,ok}
  570 +3.19% {match,ok}
  571 +2.92% {lookup_element,{error,badarg}}
  572 +2.17% {prev,ok}
  573 +1.88% {next,ok}
  574 +1.57% {next,{error,badarg}}
  575 +1.56% {prev,{error,badarg}}
  576 +0.72% {lookup_element,ok}
  577 +true
  578 +.......</tt></pre>
  579 +
  580 +
  581 +<table><tr>
  582 +<td class="icon">
  583 +Tip
  584 +</td>
  585 +<td class="content">For testing LevelDB directly using the C bindings, try<tt>qc_statemc_gen_ets:qc_run(5000)</tt>.</td>
  586 +</tr></table>
  587 +
  588 +</li>
  589 +</ol>
  590 +
  591 +
  592 +
  593 +<h2 id="_to_test_proper">To test - PropEr</h2>
  594 +
  595 +<ol class="arabic">
  596 +<li>
  597 +<p>
  598 +Make sure PropEr is in your Erlang code path. One simple way to
  599 + accomplish this is by adding the code path to your <tt>~/.erlang</tt>
  600 + resource file.
  601 +</p>
  602 +
  603 +
  604 +<pre><tt>true = code:add_pathz(os:getenv("HOME")++"/.erlang.d/deps/proper/ebin").</tt></pre>
  605 +
  606 +</li>
  607 +<li>
  608 +<p>
  609 +Compile for PropEr
  610 +</p>
  611 +
  612 +
  613 +<pre><tt>$ cd working-directory-name
  614 +$ make clean
  615 +$ make proper-compile</tt></pre>
  616 +
  617 +</li>
  618 +<li>
  619 +<p>
  620 +Run 5,000 PropEr tests
  621 +</p>
  622 +
  623 +
  624 +<pre><tt>$ cd working-directory-name/deps/gen_ets/.test
  625 +$ erl -smp +A 5 -pz -pz ../../qc/ebin
  626 +
  627 +1> qc_statem_gen_ets:qc_run(5000).
  628 +....
  629 +OK: Passed 5000 test(s).
  630 +
  631 +11% {new,ok}
  632 +8% {delete,ok}
  633 +4% {member,ok}
  634 +4% {select,ok}
  635 +4% {select_count,ok}
  636 +4% {select_reverse,ok}
  637 +4% {lookup,ok}
  638 +4% {match_object,ok}
  639 +4% {tab2list,ok}
  640 +4% {last,ok}
  641 +4% {match,ok}
  642 +4% {foldl,ok}
  643 +4% {match_delete,ok}
  644 +3% {prev,ok}
  645 +3% {select31,ok}
  646 +3% {select_delete,ok}
  647 +3% {foldr,ok}
  648 +3% {insert,ok}
  649 +3% {first,ok}
  650 +3% {next,ok}
  651 +3% {lookup_element,{error,badarg}}
  652 +1% {insert_new,ok}
  653 +0% {prev,{error,badarg}}
  654 +0% {lookup_element,ok}
  655 +0% {next,{error,badarg}}
  656 +true
  657 +.......</tt></pre>
  658 +
  659 +</li>
  660 +</ol>
  661 +
  662 +
  663 +
  664 +<h2 id="_roadmap">Roadmap</h2>
  665 +
  666 +<p><em>TODO</em></p>
  667 +
  668 +
  669 +
  670 +
  671 +##Modules##
  672 +
  673 +
  674 +<table width="100%" border="0" summary="list of modules">
  675 +<tr><td><a href="https://github.com/norton/gen_ets/blob/master/doc/gen_ets.md" class="module">gen_ets</a></td></tr>
  676 +<tr><td><a href="https://github.com/norton/gen_ets/blob/master/doc/gen_ets_impl_ets.md" class="module">gen_ets_impl_ets</a></td></tr></table>
  677 +
3  THANKS
... ... @@ -0,0 +1,3 @@
  1 +The following people have contributed to gen_ets:
  2 +
  3 +Joseph Wayne Norton
677 doc/README.md
Source Rendered
... ... @@ -0,0 +1,677 @@
  1 +
  2 +
  3 +#GEN_ETS - GEN(eric) Erlang Term Storage#
  4 +
  5 +
  6 +Copyright (c) 2011-2012 by Joseph Wayne Norton
  7 +
  8 +__Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit.edu)).<p>GEN_ETS is an generic wrapper for Erlang Term Storage with a callback
  9 +interface for a backend implementation.</p>
  10 +<p>For testing purposes, GEN_ETS supports a default backend
  11 +implementation:</p>
  12 +<ul>
  13 +<li>
  14 +<p>
  15 +<tt>ets</tt> Erlang ETS backend
  16 +</p>
  17 +</li>
  18 +</ul>
  19 +<p>GEN_ETS is not intended to be an exact clone of ETS. The currently
  20 +supported ETS APIs are:</p>
  21 +<ul>
  22 +<li>
  23 +<p>
  24 +<tt>all/0</tt>
  25 +</p>
  26 +</li>
  27 +<li>
  28 +<p>
  29 +<tt>delete/1</tt>
  30 +</p>
  31 +</li>
  32 +<li>
  33 +<p>
  34 +<tt>delete/2</tt>
  35 +</p>
  36 +</li>
  37 +<li>
  38 +<p>
  39 +<tt>delete_all_objects/1</tt>
  40 +</p>
  41 +</li>
  42 +<li>
  43 +<p>
  44 +<tt>first/1</tt>
  45 +</p>
  46 +</li>
  47 +<li>
  48 +<p>
  49 +<tt>foldl/3</tt>
  50 +</p>
  51 +</li>
  52 +<li>
  53 +<p>
  54 +<tt>foldr/3</tt>
  55 +</p>
  56 +</li>
  57 +<li>
  58 +<p>
  59 +<tt>info/1</tt> <em>only a subset of items</em>
  60 +</p>
  61 +</li>
  62 +<li>
  63 +<p>
  64 +<tt>info/2</tt> <em>only a subset of items</em>
  65 +</p>
  66 +</li>
  67 +<li>
  68 +<p>
  69 +<tt>insert/2</tt>
  70 +</p>
  71 +</li>
  72 +<li>
  73 +<p>
  74 +<tt>insert_new/2</tt>
  75 +</p>
  76 +</li>
  77 +<li>
  78 +<p>
  79 +<tt>last/1</tt>
  80 +</p>
  81 +</li>
  82 +<li>
  83 +<p>
  84 +<tt>lookup/2</tt>
  85 +</p>
  86 +</li>
  87 +<li>
  88 +<p>
  89 +<tt>lookup_element/3</tt>
  90 +</p>
  91 +</li>
  92 +<li>
  93 +<p>
  94 +<tt>match/1</tt>
  95 +</p>
  96 +</li>
  97 +<li>
  98 +<p>
  99 +<tt>match/2</tt>
  100 +</p>
  101 +</li>
  102 +<li>
  103 +<p>
  104 +<tt>match/3</tt>
  105 +</p>
  106 +</li>
  107 +<li>
  108 +<p>
  109 +<tt>match_delete/2</tt>
  110 +</p>
  111 +</li>
  112 +<li>
  113 +<p>
  114 +<tt>match_object/1</tt>
  115 +</p>
  116 +</li>
  117 +<li>
  118 +<p>
  119 +<tt>match_object/2</tt>
  120 +</p>
  121 +</li>
  122 +<li>
  123 +<p>
  124 +<tt>match_object/3</tt>
  125 +</p>
  126 +</li>
  127 +<li>
  128 +<p>
  129 +<tt>member/2</tt>
  130 +</p>
  131 +</li>
  132 +<li>
  133 +<p>
  134 +<tt>new/2</tt>
  135 +</p>
  136 +</li>
  137 +<li>
  138 +<p>
  139 +<tt>next/2</tt>
  140 +</p>
  141 +</li>
  142 +<li>
  143 +<p>
  144 +<tt>prev/2</tt>
  145 +</p>
  146 +</li>
  147 +<li>
  148 +<p>
  149 +<tt>select/1</tt>
  150 +</p>
  151 +</li>
  152 +<li>
  153 +<p>
  154 +<tt>select/2</tt>
  155 +</p>
  156 +</li>
  157 +<li>
  158 +<p>
  159 +<tt>select/3</tt>
  160 +</p>
  161 +</li>
  162 +<li>
  163 +<p>
  164 +<tt>select_count/2</tt>
  165 +</p>
  166 +</li>
  167 +<li>
  168 +<p>
  169 +<tt>select_delete/2</tt>
  170 +</p>
  171 +</li>
  172 +<li>
  173 +<p>
  174 +<tt>select_reverse/1</tt>
  175 +</p>
  176 +</li>
  177 +<li>
  178 +<p>
  179 +<tt>select_reverse/2</tt>
  180 +</p>
  181 +</li>
  182 +<li>
  183 +<p>
  184 +<tt>select_reverse/3</tt>
  185 +</p>
  186 +</li>
  187 +<li>
  188 +<p>
  189 +<tt>tab2list/1</tt>
  190 +</p>
  191 +</li>
  192 +</ul>
  193 +<p><em>This repository is experimental in nature - use at your own risk and
  194 +please contribute if you find GEN_ETS useful.</em></p>
  195 +
  196 +<h2 id="_quick_start_recipe">Quick Start Recipe</h2>
  197 +
  198 +<p>To download and build the gen_ets application in one shot, please follow
  199 +this recipe:</p>
  200 +
  201 +
  202 +<pre><tt>$ mkdir working-directory-name
  203 +$ cd working-directory-name
  204 +$ git clone https://github.com/norton/gen_ets.git gen_ets
  205 +$ cd gen_ets
  206 +$ ./rebar get-deps
  207 +$ ./rebar clean
  208 +$ ./rebar compile</tt></pre>
  209 +
  210 +<p><em>OR</em> if QuickCheck is available then follow the this recipe:</p>
  211 +
  212 +
  213 +<pre><tt>$ mkdir working-directory-name
  214 +$ cd working-directory-name
  215 +$ git clone https://github.com/norton/gen_ets.git gen_ets
  216 +$ cd gen_ets
  217 +$ ./rebar get-deps
  218 +$ ./rebar clean
  219 +$ ./rebar compile -D QC -D QC_EQC
  220 +$ ./rebar test-compile -D QC -D QC_EQC
  221 +$ (cd .test; erl -smp +A 5 -pz ../../qc/ebin)
  222 +
  223 +1> qc_statem_gen_ets:qc_run(500, []).
  224 + :
  225 + :
  226 +OK, passed 500 tests
  227 +
  228 +100.0% {1,attempts}
  229 +
  230 +7.11% {delete,ok}
  231 +6.78% {new,ok}
  232 +3.91% {insert_new,ok}
  233 +3.83% {select_reverse31,ok}
  234 +3.76% {select31,ok}
  235 +3.69% {tab2list,ok}
  236 +3.69% {match31,ok}
  237 +3.69% {first,ok}
  238 +3.67% {delete_all_objects,ok}
  239 +3.66% {foldl,ok}
  240 +3.63% {select,ok}
  241 +3.63% {member,ok}
  242 +3.61% {select_count,ok}
  243 +3.61% {last,ok}
  244 +3.61% {foldr,ok}
  245 +3.57% {insert,ok}
  246 +3.50% {match_object31,ok}
  247 +3.49% {match_delete,ok}
  248 +3.44% {lookup,ok}
  249 +3.42% {select_delete,ok}
  250 +3.36% {match_object,ok}
  251 +3.34% {select_reverse,ok}
  252 +3.19% {match,ok}
  253 +2.92% {lookup_element,{error,badarg}}
  254 +2.17% {prev,ok}
  255 +1.88% {next,ok}
  256 +1.57% {next,{error,badarg}}
  257 +1.56% {prev,{error,badarg}}
  258 +0.72% {lookup_element,ok}
  259 +true</tt></pre>
  260 +
  261 +<p>For an alternative recipe with other "features" albeit more complex,
  262 +please read further.</p>
  263 +
  264 +
  265 +
  266 +<h2 id="_documentation">Documentation</h2>
  267 +
  268 +
  269 +<h3 id="_where_should_i_start">Where should I start?</h3>
  270 +<p>This README is the only bit of documentation right now.</p>
  271 +<p>The QC (a.k.a. QuickCheck, PropEr, etc.) tests underneath the
  272 +"tests/qc" directory should be helpful for understanding the
  273 +specification and behavior of ETS and GEN_ETS. NIF-based
  274 +implementations.</p>
  275 +
  276 +
  277 +<h3 id="_what_is_ets_and_dets">What is ETS and DETS?</h3>
  278 +<p>ETS and DETS are Erlang/OTP's standard library modules for Erlang
  279 +term storage. ETS is a memory-based implementation. DETS is a
  280 +disk-based implementation.</p>
  281 +<p>See <a href="http://www.erlang.org/doc/man/ets.html">http://www.erlang.org/doc/man/ets.html</a> and
  282 +<a href="http://www.erlang.org/doc/man/dets.html">http://www.erlang.org/doc/man/dets.html</a> for further details.</p>
  283 +
  284 +
  285 +
  286 +
  287 +<h2 id="_to_download">To download</h2>
  288 +
  289 +<ol class="arabic">
  290 +<li>
  291 +<p>
  292 +Configure your e-mail and name for Git
  293 +</p>
  294 +
  295 +
  296 +<pre><tt>$ git config \--global user.email "you@example.com"
  297 +$ git config \--global user.name "Your Name"</tt></pre>
  298 +
  299 +</li>
  300 +<li>
  301 +<p>
  302 +Install Repo
  303 +</p>
  304 +
  305 +
  306 +<pre><tt>$ mkdir -p ~/bin
  307 +$ wget -O - https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
  308 +$ chmod a+x ~/bin/repo</tt></pre>
  309 +
  310 +</li>
  311 +<li>
  312 +<p>
  313 +Create working directory
  314 +</p>
  315 +
  316 +
  317 +<pre><tt>$ mkdir working-directory-name
  318 +$ cd working-directory-name
  319 +$ repo init -u https://github.com/norton/manifests.git -m gen_ets-default.xml</tt></pre>
  320 +
  321 +
  322 +<table><tr>
  323 +<td class="icon">
  324 +Note
  325 +</td>
  326 +<td class="content">Your "Git" identity is needed during the init step. Please
  327 +enter the name and email of your GitHub account if you have one. Team
  328 +members having read-write access are recommended to use "repo init -u
  329 +<a href="mailto:git@github.com">git@github.com</a>:norton/manifests.git -m gen_ets-default-rw.xml".</td>
  330 +</tr></table>
  331 +
  332 +
  333 +<table><tr>
  334 +<td class="icon">
  335 +Tip
  336 +</td>
  337 +<td class="content">If you want to checkout the latest development version, please
  338 +append " -b dev" to the repo init command.</td>
  339 +</tr></table>
  340 +
  341 +</li>
  342 +<li>
  343 +<p>
  344 +Download Git repositories
  345 +</p>
  346 +
  347 +
  348 +<pre><tt>$ cd working-directory-name
  349 +$ repo sync</tt></pre>
  350 +
  351 +</li>
  352 +</ol>
  353 +<p>For futher information and help for related tools, please refer to the
  354 +following links:</p>
  355 +<ul>
  356 +<li>
  357 +<p>
  358 +Erlang - <a href="http://www.erlang.org/">http://www.erlang.org/</a>
  359 +</p>
  360 +<ul>
  361 +<li>
  362 +<p>
  363 +<strong>R14 or newer, R15B02 has been tested recently</strong>
  364 +</p>
  365 +</li>
  366 +</ul>
  367 +</li>
  368 +<li>
  369 +<p>
  370 +Git - <a href="http://git-scm.com/">http://git-scm.com/</a>
  371 +</p>
  372 +<ul>
  373 +<li>
  374 +<p>
  375 +<strong>Git 1.5.4 or newer, Git 1.7.12 has been tested recently</strong>
  376 +</p>
  377 +</li>
  378 +<li>
  379 +<p>
  380 +<em>required for Repo and GitHub</em>
  381 +</p>
  382 +</li>
  383 +</ul>
  384 +</li>
  385 +<li>
  386 +<p>
  387 +GitHub - <a href="https://github.com">https://github.com</a>
  388 +</p>
  389 +</li>
  390 +<li>
  391 +<p>
  392 +Python - <a href="http://www.python.org">http://www.python.org</a>
  393 +</p>
  394 +<ul>
  395 +<li>
  396 +<p>
  397 +<strong>Python 2.4 or newer, Python 2.7.2 has been tested recently
  398 + (CAUTION: Python 3.x might be too new)</strong>
  399 +</p>
  400 +</li>
  401 +<li>
  402 +<p>
  403 +<em>required for Repo</em>
  404 +</p>
  405 +</li>
  406 +</ul>
  407 +</li>
  408 +<li>
  409 +<p>
  410 +Rebar - <a href="https://github.com/basho/rebar/wiki">https://github.com/basho/rebar/wiki</a>
  411 +</p>
  412 +</li>
  413 +<li>
  414 +<p>
  415 +Repo - <a href="http://source.android.com/source/git-repo.md">http://source.android.com/source/git-repo.html</a>
  416 +</p>
  417 +</li>
  418 +</ul>
  419 +
  420 +
  421 +
  422 +<h2 id="_to_build_basic_recipe">To build - basic recipe</h2>
  423 +
  424 +<ol class="arabic">
  425 +<li>
  426 +<p>
  427 +Get and install an erlang system <a href="http://www.erlang.org">http://www.erlang.org</a>
  428 +</p>
  429 +</li>
  430 +<li>
  431 +<p>
  432 +Build
  433 +</p>
  434 +
  435 +
  436 +<pre><tt>$ cd working-directory-name
  437 +$ make compile</tt></pre>
  438 +
  439 +</li>
  440 +</ol>
  441 +
  442 +
  443 +
  444 +<h2 id="_to_build_optional_features">To build - optional features</h2>
  445 +
  446 +<ol class="upperalpha">
  447 +<li>
  448 +<p>
  449 +Dialyzer Testing <em>basic recipe</em>
  450 +</p>
  451 +<ol class="arabic">
  452 +<li>
  453 +<p>
  454 +Build Dialyzer's PLT <em>(required once)</em>
  455 +</p>
  456 +
  457 +
  458 +<pre><tt>$ cd working-directory-name
  459 +$ make build-plt</tt></pre>
  460 +
  461 +
  462 +<table><tr>
  463 +<td class="icon">
  464 +Tip
  465 +</td>
  466 +<td class="content">Check Makefile and dialyzer's documentation for further
  467 +information.</td>
  468 +</tr></table>
  469 +
  470 +</li>
  471 +<li>
  472 +<p>
  473 +Dialyze with specs
  474 +</p>
  475 +
  476 +
  477 +<pre><tt>$ cd working-directory-name
  478 +$ make dialyze</tt></pre>
  479 +
  480 +
  481 +<table><tr>
  482 +<td class="icon">
  483 +Caution
  484 +</td>
  485 +<td class="content">If you manually run dialyzer with the "-r" option, execute
  486 +"make clean compile" first to avoid finding duplicate beam files
  487 +underneath rebar's .test directory. Check Makefile for further
  488 +information.</td>
  489 +</tr></table>
  490 +
  491 +</li>
  492 +<li>
  493 +<p>
  494 +Dialyze without specs
  495 +</p>
  496 +
  497 +
  498 +<pre><tt>$ cd working-directory-name
  499 +$ make dialyze-nospec</tt></pre>
  500 +
  501 +</li>
  502 +</ol>
  503 +</li>
  504 +</ol>
  505 +
  506 +
  507 +
  508 +<h2 id="_to_test_quickcheck">To test - QuickCheck</h2>
  509 +
  510 +<ol class="arabic">
  511 +<li>
  512 +<p>
  513 +Make sure QuickCheck is in your Erlang code path. One simple way
  514 + to accomplish this is by adding the code path to your <tt>~/.erlang</tt>
  515 + resource file.
  516 +</p>
  517 +
  518 +
  519 +<pre><tt>true = code:add_pathz(os:getenv("HOME")++"/.erlang.d/deps/quviq/eqc-X.Y.Z/ebin").</tt></pre>
  520 +
  521 +</li>
  522 +<li>
  523 +<p>
  524 +Compile for QuickCheck
  525 +</p>
  526 +
  527 +
  528 +<pre><tt>$ cd working-directory-name
  529 +$ make clean
  530 +$ make eqc-compile</tt></pre>
  531 +
  532 +</li>
  533 +<li>
  534 +<p>
  535 +Run 5,000 QuickCheck tests
  536 +</p>
  537 +
  538 +
  539 +<pre><tt>$ cd working-directory-name/deps/gen_ets/.test
  540 +$ erl -smp +A 5 -pz -pz ../../qc/ebin
  541 +
  542 +1> qc_statem_gen_ets:qc_run(5000).
  543 +....
  544 +OK, passed 5000 tests
  545 +
  546 +100.0% {1,attempts}
  547 +
  548 +7.11% {delete,ok}
  549 +6.78% {new,ok}
  550 +3.91% {insert_new,ok}
  551 +3.83% {select_reverse31,ok}
  552 +3.76% {select31,ok}
  553 +3.69% {tab2list,ok}
  554 +3.69% {match31,ok}
  555 +3.69% {first,ok}
  556 +3.67% {delete_all_objects,ok}
  557 +3.66% {foldl,ok}
  558 +3.63% {select,ok}
  559 +3.63% {member,ok}
  560 +3.61% {select_count,ok}
  561 +3.61% {last,ok}
  562 +3.61% {foldr,ok}
  563 +3.57% {insert,ok}
  564 +3.50% {match_object31,ok}