Add some doc/spec

This commit is contained in:
Kresten Krab Thorup 2012-05-11 12:30:20 +02:00
parent fbda7af576
commit 61720065d9
3 changed files with 13 additions and 7 deletions

View file

@ -40,6 +40,11 @@ Put these values in your `app.config` in the `hanoidb` section
%% Enable/disable on-disk compression.
%%
{compress, none | gzip},
%% Expire (automatically delete) entries after N seconds.
%% When this value is 0 (zero), entries never expire.
%%
{expiry_secs, 0},
%% Sync strategy `none' only syncs every time the
%% nursery runs full, which is currently hard coded

10
TODO
View file

@ -1,18 +1,12 @@
* Phase 1: Minimum viable product (in order of priority)
* lager; check for uses of lager:error/2
* configurable TOP_LEVEL size
* support for future file format changes
* Define a standard struct which is the metadata added at the end of the
file, e.g. [btree-nodes] [meta-data] [offset of meta-data]. This is written
in hanoi_writer:flush_nodes, and read in hanoi_reader:open2.
* test new snappy compression support
* support for time based expiry, merge should eliminate expired data
* status and statistics
* for each level {#merges, {merge-time-min, max, average}}
* add @doc strings and and -spec's
* check to make sure every error returns with a reason {error, Reason}
* clean up names, btree_range -> key_range, etc.
* Phase 2: Production Ready
* dual-nursery
@ -20,6 +14,10 @@
* {cache, bytes(), name} share max(bytes) cache named 'name' via etc
* snapshot entire database (fresh directory w/ hard links to all files)
* persist merge progress (to speed up re-opening a HanoiDB)
* support for future file format changes
* Define a standard struct which is the metadata added at the end of the
file, e.g. [btree-nodes] [meta-data] [offset of meta-data]. This is written
in hanoi_writer:flush_nodes, and read in hanoi_reader:open2.
* Phase 3: Wish List
* add truncate/1 - quickly truncates a database to 0 items

View file

@ -221,11 +221,14 @@ decode_kv_data(<<?TAG_TRANSACT, Rest/binary>>) ->
%%%%%%%
%% Return number of seconds since 1970
%% @doc Return number of seconds since 1970
-spec tstamp() -> pos_integer().
tstamp() ->
{Mega, Sec, _Micro} = os:timestamp(),
(Mega * 1000000) + Sec.
%% @doc Return time when values expire (i.e. Now - ExpirySecs), or 0.
-spec expiry_time([_]) -> pos_integer().
expiry_time(Opts) ->
ExpirySecs = hanoidb:get_opt(expiry_secs, Opts),
case ExpirySecs > 0 of