From 836a009ab1968980be403fa376ae2812b78a92ee Mon Sep 17 00:00:00 2001 From: Joseph Wayne Norton Date: Sat, 19 Nov 2011 23:39:23 +0900 Subject: [PATCH] Add support for ets match, ets select, and friends --- README.md | 257 ++++++++++--- c_src/lets_drv.cc | 623 +++++++++++++++++++++++++++++++- c_src/lets_nif.cc | 316 +++++++++++++++- c_src/lets_nif.h | 14 + doc/README.md | 257 ++++++++++--- doc/lets.md | 496 ++++++++++++++++++++++++- doc/lets_drv.md | 265 ++++++++++++-- doc/lets_ets.md | 265 ++++++++++++-- doc/lets_nif.md | 265 ++++++++++++-- doc/overview.edoc | 127 ++++++- rebar | Bin 109590 -> 109918 bytes src/lets.erl | 596 +++++++++++++++++++++++++----- src/lets.hrl | 4 +- src/lets_drv.erl | 508 +++++++++++++++++++++----- src/lets_ets.erl | 152 ++++++-- src/lets_nif.erl | 435 ++++++++++++++++++---- test/qc/qc_lets_proxy.erl | 249 +++++++++++-- test/qc/qc_lets_raw.erl | 116 +++++- test/qc/qc_lets_slave_proxy.erl | 118 +++++- test/qc/qc_leveldb.erl | 34 ++ test/qc/qc_statem_lets.erl | 406 +++++++++++++++++++-- test/qc/qc_statemc_lets.erl | 58 ++- 22 files changed, 4908 insertions(+), 653 deletions(-) diff --git a/README.md b/README.md index 97b7153..f32d932 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ __Authors:__ Joseph Wayne Norton ([`norton@alum.mit.edu`](mailto:norton@alum.mit storage implementation. LETS tries to address some bad properties of ETS and DETS. ETS is limited by physical memory. DETS is limited by a 2 GB file size limitation and does not implement ordered sets. LETS -has neither of these limitations.

+has neither of these limitations. Data can also be automatically +compressed using the Snappy compression library.

For testing and comparison purposes, LETS supports three implementations:

LETS is not intended to be an exact clone of ETS. The currently -supported APIs are:

+supported ETS APIs are:

.next/2

Returns the next key Key2, following the key Key1 in the table Tab. If there is no next key, $end_of_table is +returned.

.prev/2

Returns the previous key Key2, following the key Key1 in +the table Tab. If there is no previous key, $end_of_table is returned.

.repair/2

If a table cannot be opened, you may attempt to call this method to resurrect as much of the contents of the table as possible. Some data may be lost, so be careful when calling this function on a table that contains important information. This -function only applies to driver and nif implementations.

.tab2list/1

Returns a list of all objects in the table Tab. The +function only applies to driver and nif implementations.

.select/1

Continues a select started with select/3.

.select/2

Matches the objects in the table Tab against the spec +Spec.

.select/3

Matches the objects in the table Tab against the spec Spec +and returns a limited (Limit) number of matching objects.

.select_count/2

Counts all objects which match the spec Spec from the +table Tab and returns the number matched.

.select_delete/2

Deletes all objects which match the spec Spec from the +table Tab and returns the number deleted.

.select_reverse/1

Continues a select reverse started with select_reverse/3.

.select_reverse/2

Matches in reverse the objects in the table Tab against the +spec Spec.

.select_reverse/3

Matches in reverse the objects in the table Tab against the +spec Spec and returns a limited (Limit) number of matching +objects.

.tab2list/1

Returns a list of all objects in the table Tab. The operation is not guaranteed to be atomic and isolated.

. @@ -412,7 +501,7 @@ __See also:__ [ets:delete_all_objects/1](ets.md#delete_all_objects-1). +__See also:__ [ets:first/1](ets.md#first-1). -###info/2## +###foldl/3## -
info(Tab::[tab()](#type-tab), Item::atom()) -> term()
+
foldl(Fun, Acc0::term(), Tab::[tab()](#type-tab)) -> Acc1::term()
+ + + + +

Fold from left to right over the elements of the table.

+ + +__See also:__ [ets:foldl/3](ets.md#foldl-3). + +###foldr/3## + + + + +
foldr(Fun, Acc0::term(), Tab::[tab()](#type-tab)) -> Acc1::term()
+ + + + +

Fold from right to left over the elements of the table.

+ + +__See also:__ [ets:foldr/3](ets.md#foldr-3). + +###info/1## + + + + +
info(Tab::[tab()](#type-tab)) -> [{[item()](#type-item), term()}]


@@ -454,6 +573,22 @@ __See also:__ [ets:first/1](ets.md#first-1). Value} tuples.

+__See also:__ [info/2](#info-2). + +###info/2## + + + + +
info(Tab::[tab()](#type-tab), Item::[item()](#type-item)) -> term()
+

+ + + + +

Returns the information associated with Item for the table Tab.

+ +
Valid +Item+ options are: