Skip to content

Instantly share code, notes, and snippets.

@tylerflint
Last active August 29, 2015 13:57
Show Gist options
  • Save tylerflint/9643815 to your computer and use it in GitHub Desktop.
Save tylerflint/9643815 to your computer and use it in GitHub Desktop.
hanoidb cuttlefish schema
%% -*- mode: erlang; tab-width: 4; indent-tabs-mode: 1; st-rulers: [70] -*-
%% vim: ts=4 sw=4 ft=erlang noet
%%%===================================================================
%%% hanoidb
%%%===================================================================
%% @doc hanoidb database directory
{mapping, "hanoidb.db_path", "hanoidb.data_root", [
{datatype, string},
{default, "{{platform_data_dir}}/{{hanoidb_db_path}}"}
]}.
%% @doc Enable/disable on-disk compression.
{mapping, "hanoidb.compress", "hanoidb.compress", [
{datatype, {enum, [none, gzip]}},
{default, none}
]}.
%% @doc Expire (automatically delete) entries after N seconds.
%% When this value is 0 (zero), entries never expire.
{mapping, "hanoidb.expiry_secs", "hanoidb.expiry_secs", [
{datatype, integer},
{default, 0}
]}.
%% @doc Sync strategy `none' only syncs every time the
%% nursery runs full, which is currently hard coded
%% to be evert 256 inserts or deletes.
%%
%% Sync strategy `sync' will sync the nursery log
%% for every insert or delete operation.
{mapping, "hanoidb.sync_strategy", "hanoidb.sync_strategy", [
{commented, "none"},
{datatype, string}
]}.
{translation, "hanoidb.sync_strategy", fun(Config) ->
case cuttlefish_util:conf_get_value("hanoidb.sync_strategy", Config) of
"none" ->
none;
"sync" ->
sync;
N ->
try list_to_integer(N) of
Seconds when is_integer(Seconds) ->
{seconds, Seconds}
catch
_:_ ->
none
end
end
end}.
%% @doc The page size is a minimum page size, when a page fills
%% up to beyond this size, it is written to disk.
%% Compression applies to such units of page size.
{mapping, "hanoidb.page_size", "hanoidb.page_size", [
{commented, 8192},
{datatype, integer}
]}.
%% @doc Read/write buffer sizes apply to merge processes.
%% A merge process has two read buffers and a write
%% buffer, and there is a merge process *per level* in
%% the database.
{mapping, "hanoidb.write_buffer_size", "hanoidb.write_buffer_size", [
{datatype, bytesize},
{default, "512KB"}
]}.
{mapping, "hanoidb.read_buffer_size", "hanoidb.read_buffer_size", [
{datatype, bytesize},
{default, "512KB"}
]}.
%% @doc The merge strategy is one of `fast' or `predictable'.
%% Both have same log2(N) worst case, but `fast' is
%% sometimes faster; yielding latency fluctuations.
{mapping, "hanoidb.merge_strategy", "hanoidb.merge_strategy", [
{datatype, {enum, [fast, predictable]}},
{default, fast}
]}.
## hanoidb database directory
hanoidb.db_path = ./data/hanoidb
## Enable/disable on-disk compression.
hanoidb.compress = none
## Expire (automatically delete) entries after N seconds.
## When this value is 0 (zero), entries never expire.
hanoidb.expiry_secs = 0
## Sync strategy `none' only syncs every time the
## nursery runs full, which is currently hard coded
## to be evert 256 inserts or deletes.
## Sync strategy `sync' will sync the nursery log
## for every insert or delete operation.
## hanoidb.sync_strategy = none
## The page size is a minimum page size, when a page fills
## up to beyond this size, it is written to disk.
## Compression applies to such units of page size.
## hanoidb.page_size = 8192
## Read/write buffer sizes apply to merge processes.
## A merge process has two read buffers and a write
## buffer, and there is a merge process *per level* in
## the database.
hanoidb.write_buffer_size = 512KB
hanoidb.read_buffer_size = 512KB
## The merge strategy is one of `fast' or `predictable'.
## Both have same log2(N) worst case, but `fast' is
## sometimes faster; yielding latency fluctuations.
hanoidb.merge_strategy = fast
{hanoidb,
[{merge_strategy,fast},
{read_buffer_size,524288},
{write_buffer_size,524288},
{expiry_secs,0},
{compress,none},
{data_root,"./data/hanoidb"}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment