Skip to content

Commit

Permalink
Merge pull request #125 from basho/jd-cuttlefish-api
Browse files Browse the repository at this point in the history
Updated schema for new cuttlefish api
  • Loading branch information
joedevivo committed Dec 11, 2013
2 parents fc65e3c + 3cede95 commit 1771986
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
86 changes: 43 additions & 43 deletions priv/bitcask.schema
Expand Up @@ -7,11 +7,11 @@
{default, "{{platform_data_dir}}/bitcask"}
]}.

%% @doc The open_timeout setting specifies the maximum time Bitcask will
%% block on startup while attempting to create or open the data directory.
%% The value is in seconds and the default is 4. You generally need not
%% change this value. If for some reason the timeout is exceeded on open
%% you'll see a log message of the form:
%% @doc The open_timeout setting specifies the maximum time Bitcask will
%% block on startup while attempting to create or open the data directory.
%% The value is in seconds and the default is 4. You generally need not
%% change this value. If for some reason the timeout is exceeded on open
%% you'll see a log message of the form:
%% "Failed to start bitcask backend: .... "
%% Only then should you consider a longer timeout.
{mapping, "bitcask.open_timeout", "bitcask.open_timeout", [
Expand Down Expand Up @@ -52,15 +52,15 @@
{level, advanced}
]}.

{translation,
"bitcask.sync_strategy",
fun(Conf) ->
Setting = cuttlefish_util:conf_get_value("bitcask.sync_strategy", Conf),
{translation,
"bitcask.sync_strategy",
fun(Conf) ->
Setting = cuttlefish:conf_get("bitcask.sync_strategy", Conf),
case Setting of
none -> none;
o_sync -> o_sync;
interval ->
Interval = cuttlefish_util:conf_get_value("bitcask.sync_interval", Conf, undefined),
Interval = cuttlefish:conf_get("bitcask.sync_interval", Conf, undefined),
{seconds, Interval};
_Default -> none
end
Expand All @@ -79,13 +79,13 @@

%% @doc The `merge_window` setting lets you specify when during the day merge
%% operations are allowed to be triggered. Valid options are:
%%
%%
%% * `always` (default) No restrictions
%% * `never` Merge will never be attempted
%% * `window` Hours during which merging is permitted, where
%% * `window` Hours during which merging is permitted, where
%% `bitcask.merge_window.start` and
%% `bitcask.merge_window.end` are integers between 0 and 23.
%%
%%
%% If merging has a significant impact on performance of your cluster, or your
%% cluster has quiet periods in which little storage activity occurs, you may
%% want to change this setting from the default.
Expand All @@ -108,16 +108,16 @@
]}.


{translation,
"bitcask.merge_window",
fun(Conf) ->
Setting = cuttlefish_util:conf_get_value("bitcask.merge_window", Conf),
{translation,
"bitcask.merge_window",
fun(Conf) ->
Setting = cuttlefish:conf_get("bitcask.merge_window", Conf),
case Setting of
always -> always;
never -> never;
window ->
Start = cuttlefish_util:conf_get_value("bitcask.merge_window.start", Conf, undefined),
End = cuttlefish_util:conf_get_value("bitcask.merge_window.end", Conf, undefined),
Start = cuttlefish:conf_get("bitcask.merge_window.start", Conf, undefined),
End = cuttlefish:conf_get("bitcask.merge_window.end", Conf, undefined),
{Start, End};
_Default -> always
end
Expand All @@ -129,25 +129,25 @@
%% dead keys and 4 live keys, then merge will be triggered at the default
%% setting. Increasing this value will cause merging to occur less often,
%% whereas decreasing the value will cause merging to happen more often.
%%
%%
%% Default is: `60`
{mapping, "bitcask.frag_merge_trigger", "bitcask.frag_merge_trigger", [
{datatype, integer},
{level, advanced},
{default, 60}
]}.


%% @doc `dead_bytes_merge_trigger` setting describes how much
%% data stored for dead keys in a single file will trigger merging. The
%% value is in bytes. If a file meets or exceeds the trigger value for dead
%% bytes, merge will be triggered. Increasing the value will cause merging
%% to occur less often, whereas decreasing the value will cause merging to
%% happen more often.
%%
%%
%% When either of these constraints are met by any file in the directory,
%% Bitcask will attempt to merge files.
%%
%%
%% Default is: 512MB in bytes
{mapping, "bitcask.dead_bytes_merge_trigger", "bitcask.dead_bytes_merge_trigger", [
{datatype, bytesize},
Expand All @@ -162,7 +162,7 @@
%% in the merge at the default ratio. Increasing the value will cause fewer
%% files to be merged, decreasing the value will cause more files to be
%% merged.
%%
%%
%% Default is: `40`
{mapping, "bitcask.frag_threshold", "bitcask.frag_threshold", [
{datatype, integer},
Expand All @@ -174,7 +174,7 @@
%% amount of data occupied by dead keys in a file to cause it to be included
%% in the merge. Increasing the value will cause fewer files to be merged,
%% decreasing the value will cause more files to be merged.
%%
%%
%% Default is: 128MB in bytes
{mapping, "bitcask.dead_bytes_threshold", "bitcask.dead_bytes_threshold", [
{datatype, bytesize},
Expand All @@ -187,7 +187,7 @@
%% than the threshold will be included. Increasing the value will cause
%% _more_ files to be merged, decreasing the value will cause _fewer_ files
%% to be merged.
%%
%%
%% Default is: 10MB in bytes
{mapping, "bitcask.small_file_threshold", "bitcask.small_file_threshold", [
{datatype, bytesize},
Expand Down Expand Up @@ -216,7 +216,7 @@
%% limited time-value, or if for space reasons you need to purge data, you can
%% set the `expiry_secs` option. If you needed to purge data automatically
%% after 1 day, set the value to `1d`.
%%
%%
%% Default is: `-1` which disables automatic expiration
{mapping, "bitcask.expiry", "bitcask.expiry_secs", [
{datatype, {duration, s}},
Expand Down Expand Up @@ -267,11 +267,11 @@
]}.


%% @doc The open_timeout setting specifies the maximum time Bitcask will
%% block on startup while attempting to create or open the data directory.
%% The value is in seconds and the default is 4. You generally need not
%% change this value. If for some reason the timeout is exceeded on open
%% you'll see a log message of the form:
%% @doc The open_timeout setting specifies the maximum time Bitcask will
%% block on startup while attempting to create or open the data directory.
%% The value is in seconds and the default is 4. You generally need not
%% change this value. If for some reason the timeout is exceeded on open
%% you'll see a log message of the form:
%% "Failed to start bitcask backend: .... "
%% Only then should you consider a longer timeout.
{mapping, "multi_backend.$name.bitcask.open_timeout", "riak_kv.multi_backend", [
Expand Down Expand Up @@ -325,13 +325,13 @@

%% @doc The `merge_window` setting lets you specify when during the day merge
%% operations are allowed to be triggered. Valid options are:
%%
%%
%% * `always` (default) No restrictions
%% * `never` Merge will never be attempted
%% * `window` Hours during which merging is permitted, where
%% * `window` Hours during which merging is permitted, where
%% `bitcask.merge_window.start` and
%% `bitcask.merge_window.end` are integers between 0 and 23.
%%
%%
%% If merging has a significant impact on performance of your cluster, or your
%% cluster has quiet periods in which little storage activity occurs, you may
%% want to change this setting from the default.
Expand Down Expand Up @@ -359,25 +359,25 @@
%% dead keys and 4 live keys, then merge will be triggered at the default
%% setting. Increasing this value will cause merging to occur less often,
%% whereas decreasing the value will cause merging to happen more often.
%%
%%
%% Default is: `60`
{mapping, "multi_backend.$name.bitcask.frag_merge_trigger", "riak_kv.multi_backend", [
{datatype, integer},
{level, advanced},
{default, 60}
]}.


%% @doc `dead_bytes_merge_trigger` setting describes how much
%% data stored for dead keys in a single file will trigger merging. The
%% value is in bytes. If a file meets or exceeds the trigger value for dead
%% bytes, merge will be triggered. Increasing the value will cause merging
%% to occur less often, whereas decreasing the value will cause merging to
%% happen more often.
%%
%%
%% When either of these constraints are met by any file in the directory,
%% Bitcask will attempt to merge files.
%%
%%
%% Default is: 512mb in bytes
{mapping, "multi_backend.$name.bitcask.dead_bytes_merge_trigger", "riak_kv.multi_backend", [
{datatype, bytesize},
Expand All @@ -392,7 +392,7 @@
%% in the merge at the default ratio. Increasing the value will cause fewer
%% files to be merged, decreasing the value will cause more files to be
%% merged.
%%
%%
%% Default is: `40`
{mapping, "multi_backend.$name.bitcask.frag_threshold", "riak_kv.multi_backend", [
{datatype, integer},
Expand All @@ -404,7 +404,7 @@
%% amount of data occupied by dead keys in a file to cause it to be included
%% in the merge. Increasing the value will cause fewer files to be merged,
%% decreasing the value will cause more files to be merged.
%%
%%
%% Default is: 128mb in bytes
{mapping, "multi_backend.$name.bitcask.dead_bytes_threshold", "riak_kv.multi_backend", [
{datatype, bytesize},
Expand All @@ -417,7 +417,7 @@
%% than the threshold will be included. Increasing the value will cause
%% _more_ files to be merged, decreasing the value will cause _fewer_ files
%% to be merged.
%%
%%
%% Default is: 10mb in bytes
{mapping, "multi_backend.$name.bitcask.small_file_threshold", "riak_kv.multi_backend", [
{datatype, bytesize},
Expand Down Expand Up @@ -446,7 +446,7 @@
%% limited time-value, or if for space reasons you need to purge data, you can
%% set the `expiry_secs` option. If you needed to purge data automatically
%% after 1 day, set the value to `1d`.
%%
%%
%% Default is: `-1` which disables automatic expiration
{mapping, "multi_backend.$name.bitcask.expiry", "riak_kv.multi_backend", [
{datatype, {duration, s}},
Expand Down
12 changes: 6 additions & 6 deletions test/bitcask_schema_tests.erl
Expand Up @@ -6,7 +6,7 @@
%% basic schema test will check to make sure that all defaults from the schema
%% make it into the generated app.config
basic_schema_test() ->
%% The defaults are defined in ../priv/bitcask.schema. it is the file under test.
%% The defaults are defined in ../priv/bitcask.schema. it is the file under test.
Config = cuttlefish_unit:generate_templated_config("../priv/bitcask.schema", [], context()),

cuttlefish_unit:assert_config(Config, "bitcask.data_root", "./data/bitcask"),
Expand All @@ -27,7 +27,7 @@ basic_schema_test() ->
cuttlefish_unit:assert_config(Config, "bitcask.io_mode", erlang),

%% Make sure no multi_backend
cuttlefish_unit:assert_config(Config, "riak_kv.multi_backend", undefined),
cuttlefish_unit:assert_not_configured(Config, "riak_kv.multi_backend"),
ok.

merge_window_test() ->
Expand All @@ -37,7 +37,7 @@ merge_window_test() ->
{["bitcask", "merge_window", "end"], 12}
],

%% The defaults are defined in ../priv/bitcask.schema. it is the file under test.
%% The defaults are defined in ../priv/bitcask.schema. it is the file under test.
Config = cuttlefish_unit:generate_templated_config("../priv/bitcask.schema", Conf, context()),

cuttlefish_unit:assert_config(Config, "bitcask.data_root", "./data/bitcask"),
Expand All @@ -58,7 +58,7 @@ merge_window_test() ->
cuttlefish_unit:assert_config(Config, "bitcask.io_mode", erlang),

%% Make sure no multi_backend
cuttlefish_unit:assert_config(Config, "riak_kv.multi_backend", undefined),
cuttlefish_unit:assert_not_configured(Config, "riak_kv.multi_backend"),
ok.

override_schema_test() ->
Expand Down Expand Up @@ -86,7 +86,7 @@ override_schema_test() ->
{["bitcask", "io_mode"], nif}
],

%% The defaults are defined in ../priv/bitcask.schema. it is the file under test.
%% The defaults are defined in ../priv/bitcask.schema. it is the file under test.
Config = cuttlefish_unit:generate_templated_config("../priv/bitcask.schema", Conf, context()),

cuttlefish_unit:assert_config(Config, "bitcask.data_root", "/absolute/data/bitcask"),
Expand All @@ -107,7 +107,7 @@ override_schema_test() ->
cuttlefish_unit:assert_config(Config, "bitcask.io_mode", nif),

%% Make sure no multi_backend
cuttlefish_unit:assert_config(Config, "riak_kv.multi_backend", undefined),
cuttlefish_unit:assert_not_configured(Config, "riak_kv.multi_backend"),
ok.

%% this context() represents the substitution variables that rebar will use during the build process.
Expand Down

0 comments on commit 1771986

Please sign in to comment.