Skip to content

Commit

Permalink
Add some doc/spec
Browse files Browse the repository at this point in the history
  • Loading branch information
krestenkrab committed May 11, 2012
1 parent fbda7af commit 6172006
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions TODO
@@ -1,25 +1,23 @@
* 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
* cache for read-path
* {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
Expand Down
5 changes: 4 additions & 1 deletion src/hanoidb_util.erl
Expand Up @@ -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
Expand Down

0 comments on commit 6172006

Please sign in to comment.