Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #138 from basho/jd-rhs

Cuttlefish schema RHS sub for platform_bin_dir
  • Loading branch information...
commit 5ff44fc6ea54605f24021989bc77195066744374 2 parents d187158 + 6faed59
@joedevivo joedevivo authored
Showing with 158 additions and 155 deletions.
  1. +143 −148 priv/bitcask.schema
  2. +15 −7 test/bitcask_schema_tests.erl
View
291 priv/bitcask.schema
@@ -4,7 +4,13 @@
%% @doc A path under which bitcask data files will be stored.
{mapping, "bitcask.data_root", "bitcask.data_root", [
- {default, "{{platform_data_dir}}/bitcask"},
+ {default, "#(platform_data_dir)/bitcask"},
+ {datatype, directory}
+]}.
+
+%% @see bitcask.data_root
+{mapping, "multi_backend.$name.bitcask.data_root", "riak_kv.multi_backend", [
+ hidden,
{datatype, directory}
]}.
@@ -17,7 +23,14 @@
{mapping, "bitcask.open_timeout", "bitcask.open_timeout", [
{default, "4s"},
{datatype, {duration, s}},
- {level, advanced}
+ hidden
+]}.
+
+%% @see bitcask.open_timeout
+{mapping, "multi_backend.$name.bitcask.open_timeout", "riak_kv.multi_backend", [
+ {default, "4s"},
+ {datatype, {duration, s}},
+ hidden
]}.
%% @doc Changes the durability of writes by specifying when to
@@ -49,13 +62,26 @@
{mapping, "bitcask.sync.strategy", "bitcask.sync_strategy", [
{default, none},
{datatype, {enum, [none, o_sync, interval]}},
- {level, advanced}
+ hidden
+]}.
+
+%% @see bitcask.sync.strategy
+{mapping, "multi_backend.$name.bitcask.sync.strategy", "riak_kv.multi_backend", [
+ {default, none},
+ {datatype, {enum, [none, o_sync, interval]}},
+ hidden
]}.
%% @see bitcask.sync.strategy
{mapping, "bitcask.sync.interval", "bitcask.sync_strategy", [
{datatype, {duration, s}},
- {level, advanced}
+ hidden
+]}.
+
+%% @see bitcask.sync.strategy
+{mapping, "multi_backend.$name.bitcask.sync.interval", "riak_kv.multi_backend", [
+ {datatype, {duration, s}},
+ hidden
]}.
{translation,
@@ -79,9 +105,15 @@
{mapping, "bitcask.max_file_size", "bitcask.max_file_size", [
{default, "2GB"},
{datatype, bytesize},
- {level, advanced}
+ hidden
]}.
+%% @see bitcask.max_file_size
+{mapping, "multi_backend.$name.bitcask.max_file_size", "riak_kv.multi_backend", [
+ {default, "2GB"},
+ {datatype, bytesize},
+ hidden
+]}.
%% @doc Lets you specify when during the day merge operations are
%% allowed to be triggered. Valid options are:
@@ -98,23 +130,43 @@
{mapping, "bitcask.merge.policy", "bitcask.merge_window", [
{default, always},
{datatype, {enum, [always, never, window]}},
- {level, advanced}
+ hidden
+]}.
+
+%% @see bitcask.merge.policy
+{mapping, "multi_backend.$name.bitcask.merge.policy", "riak_kv.multi_backend", [
+ {default, always},
+ {datatype, {enum, [always, never, window]}},
+ hidden
]}.
%% @see bitcask.merge.policy
{mapping, "bitcask.merge.window.start", "bitcask.merge_window", [
{default, 0},
{datatype, integer},
- {level, advanced}
+ hidden
+]}.
+
+%% @see bitcask.merge.policy
+{mapping, "multi_backend.$name.bitcask.merge.window.start", "riak_kv.multi_backend", [
+ {default, 0},
+ {datatype, integer},
+ hidden
]}.
%% @see bitcask.merge.policy
{mapping, "bitcask.merge.window.end", "bitcask.merge_window", [
{default, 23},
{datatype, integer},
- {level, advanced}
+ hidden
]}.
+%% @see bitcask.merge.policy
+{mapping, "multi_backend.$name.bitcask.merge.window.end", "riak_kv.multi_backend", [
+ {default, 23},
+ {datatype, integer},
+ hidden
+]}.
{translation,
"bitcask.merge_window",
@@ -144,7 +196,15 @@
"bitcask.frag_merge_trigger",
[
{datatype, integer},
- {level, advanced},
+ hidden,
+ {default, 60},
+ {validators, ["is_percentage"]}
+]}.
+
+%% @see bitcask.merge.triggers.fragmentation
+{mapping, "multi_backend.$name.bitcask.merge.triggers.fragmentation", "riak_kv.multi_backend", [
+ {datatype, integer},
+ hidden,
{default, 60},
{validators, ["is_percentage"]}
]}.
@@ -171,7 +231,14 @@
"bitcask.dead_bytes_merge_trigger",
[
{datatype, bytesize},
- {level, advanced},
+ hidden,
+ {default, "512MB"}
+]}.
+
+%% @see bitcask.merge.triggers.dead_bytes
+{mapping, "multi_backend.$name.bitcask.merge.triggers.dead_bytes", "riak_kv.multi_backend", [
+ {datatype, bytesize},
+ hidden,
{default, "512MB"}
]}.
@@ -187,7 +254,15 @@
"bitcask.frag_threshold",
[
{datatype, integer},
- {level, advanced},
+ hidden,
+ {default, 40},
+ {validators, ["is_percentage"]}
+]}.
+
+%% @see bitcask.merge.thresholds.fragmentation
+{mapping, "multi_backend.$name.bitcask.thresholds.fragmentation", "riak_kv.multi_backend", [
+ {datatype, integer},
+ hidden,
{default, 40},
{validators, ["is_percentage"]}
]}.
@@ -201,7 +276,14 @@
{mapping, "bitcask.merge.thresholds.dead_bytes",
"bitcask.dead_bytes_threshold", [
{datatype, bytesize},
- {level, advanced},
+ hidden,
+ {default, "128MB"}
+]}.
+
+%% @see bitcask.merge.thresholds.dead_bytes
+{mapping, "multi_backend.$name.bitcask.thresholds.dead_bytes", "riak_kv.multi_backend", [
+ {datatype, bytesize},
+ hidden,
{default, "128MB"}
]}.
@@ -214,7 +296,14 @@
{mapping, "bitcask.merge.thresholds.small_file",
"bitcask.small_file_threshold", [
{datatype, bytesize},
- {level, advanced},
+ hidden,
+ {default, "10MB"}
+]}.
+
+%% @see bitcask.merge.thresholds.small_file
+{mapping, "multi_backend.$name.bitcask.thresholds.small_file", "riak_kv.multi_backend", [
+ {datatype, bytesize},
+ hidden,
{default, "10MB"}
]}.
@@ -225,7 +314,14 @@
%% to disable.
{mapping, "bitcask.fold.max_age", "bitcask.max_fold_age", [
{datatype, [{atom, unlimited}, {duration, ms}]},
- {level, advanced},
+ hidden,
+ {default, unlimited}
+]}.
+
+%% @see bitcask.fold.max_age
+{mapping, "multi_backend.$name.bitcask.fold.max_age", "riak_kv.multi_backend", [
+ {datatype, [{atom, unlimited}, {duration, ms}]},
+ hidden,
{default, unlimited}
]}.
@@ -244,7 +340,14 @@
%% @see bitcask.fold.max_age
{mapping, "bitcask.fold.max_puts", "bitcask.max_fold_puts", [
{datatype, [integer, {atom, unlimited}]},
- {level, advanced},
+ hidden,
+ {default, 0}
+]}.
+
+%% @see bitcask.fold.max_age
+{mapping, "multi_backend.$name.bitcask.fold.max_puts", "riak_kv.multi_backend", [
+ {datatype, [integer, {atom, unlimited}]},
+ hidden,
{default, 0}
]}.
@@ -266,7 +369,14 @@
%% Default is: `off` which disables automatic expiration
{mapping, "bitcask.expiry", "bitcask.expiry_secs", [
{datatype, [{atom, off}, {duration, s}]},
- {level, advanced},
+ hidden,
+ {default, off}
+]}.
+
+%% @see bitcask.expiry
+{mapping, "multi_backend.$name.bitcask.expiry", "riak_kv.multi_backend", [
+ {datatype, [{atom, off}, {duration, s}]},
+ hidden,
{default, off}
]}.
@@ -287,7 +397,14 @@
{mapping, "bitcask.hintfile_checksums", "bitcask.require_hint_crc", [
{default, strict},
{datatype, {enum, [strict, allow_missing]}},
- {level, advanced}
+ hidden
+]}.
+
+%% @see bitcask.hintfile_checksums
+{mapping, "multi_backend.$name.bitcask.hintfile_checksums", "riak_kv.multi_backend", [
+ {default, strict},
+ {datatype, {enum, [strict, allow_missing]}},
+ hidden
]}.
{translation, "bitcask.require_hint_crc",
@@ -310,7 +427,14 @@
%% Default is: `0`
{mapping, "bitcask.expiry.grace_time", "bitcask.expiry_grace_time", [
{datatype, {duration, s}},
- {level, advanced},
+ hidden,
+ {default, 0}
+]}.
+
+%% @see bitcask.expiry.grace_time
+{mapping, "multi_backend.$name.bitcask.expiry.grace_time", "riak_kv.multi_backend", [
+ {datatype, {duration, s}},
+ hidden,
{default, 0}
]}.
@@ -327,138 +451,9 @@
{datatype, {enum, [erlang, nif]}}
]}.
-%% @see bitcask.data_root
-{mapping, "multi_backend.$name.bitcask.data_root", "riak_kv.multi_backend", [
- {level, advanced},
- {datatype, directory}
-]}.
-
-%% @see bitcask.open_timeout
-{mapping, "multi_backend.$name.bitcask.open_timeout", "riak_kv.multi_backend", [
- {default, "4s"},
- {datatype, {duration, s}},
- {level, advanced}
-]}.
-
-%% @see bitcask.sync.strategy
-{mapping, "multi_backend.$name.bitcask.sync.strategy", "riak_kv.multi_backend", [
- {default, none},
- {datatype, {enum, [none, o_sync, interval]}},
- {level, advanced}
-]}.
-
-%% @see bitcask.sync.strategy
-{mapping, "multi_backend.$name.bitcask.sync.interval", "riak_kv.multi_backend", [
- {datatype, {duration, s}},
- {level, advanced}
-]}.
-
-%% @see bitcask.max_file_size
-{mapping, "multi_backend.$name.bitcask.max_file_size", "riak_kv.multi_backend", [
- {default, "2GB"},
- {datatype, bytesize},
- {level, advanced}
-]}.
-
-
-%% @see bitcask.merge.policy
-{mapping, "multi_backend.$name.bitcask.merge.policy", "riak_kv.multi_backend", [
- {default, always},
- {datatype, {enum, [always, never, window]}},
- {level, advanced}
-]}.
-
-%% @see bitcask.merge.policy
-{mapping, "multi_backend.$name.bitcask.merge.window.start", "riak_kv.multi_backend", [
- {default, 0},
- {datatype, integer},
- {level, advanced}
-]}.
-
-%% @see bitcask.merge.policy
-{mapping, "multi_backend.$name.bitcask.merge.window.end", "riak_kv.multi_backend", [
- {default, 23},
- {datatype, integer},
- {level, advanced}
-]}.
-
-%% @see bitcask.merge.triggers.fragmentation
-{mapping, "multi_backend.$name.bitcask.merge.triggers.fragmentation", "riak_kv.multi_backend", [
- {datatype, integer},
- {level, advanced},
- {default, 60},
- {validators, ["is_percentage"]}
-]}.
-
-
-%% @see bitcask.merge.triggers.dead_bytes
-{mapping, "multi_backend.$name.bitcask.merge.triggers.dead_bytes", "riak_kv.multi_backend", [
- {datatype, bytesize},
- {level, advanced},
- {default, "512MB"}
-]}.
-
-%% @see bitcask.merge.thresholds.fragmentation
-{mapping, "multi_backend.$name.bitcask.thresholds.fragmentation", "riak_kv.multi_backend", [
- {datatype, integer},
- {level, advanced},
- {default, 40},
- {validators, ["is_percentage"]}
-]}.
-
-%% @see bitcask.merge.thresholds.dead_bytes
-{mapping, "multi_backend.$name.bitcask.thresholds.dead_bytes", "riak_kv.multi_backend", [
- {datatype, bytesize},
- {level, advanced},
- {default, "128MB"}
-]}.
-
-%% @see bitcask.merge.thresholds.small_file
-{mapping, "multi_backend.$name.bitcask.thresholds.small_file", "riak_kv.multi_backend", [
- {datatype, bytesize},
- {level, advanced},
- {default, "10MB"}
-]}.
-
-%% @see bitcask.fold.max_age
-{mapping, "multi_backend.$name.bitcask.fold.max_age", "riak_kv.multi_backend", [
- {datatype, [{atom, unlimited}, {duration, ms}]},
- {level, advanced},
- {default, unlimited}
-]}.
-
-%% @see bitcask.fold.max_age
-{mapping, "multi_backend.$name.bitcask.fold.max_puts", "riak_kv.multi_backend", [
- {datatype, [integer, {atom, unlimited}]},
- {level, advanced},
- {default, 0}
-]}.
-
-%% @see bitcask.expiry
-{mapping, "multi_backend.$name.bitcask.expiry", "riak_kv.multi_backend", [
- {datatype, [{atom, off}, {duration, s}]},
- {level, advanced},
- {default, off}
-]}.
-
-
-%% @see bitcask.hintfile_checksums
-{mapping, "multi_backend.$name.bitcask.hintfile_checksums", "riak_kv.multi_backend", [
- {default, strict},
- {datatype, {enum, [strict, allow_missing]}},
- {level, advanced}
-]}.
-
-%% @see bitcask.expiry.grace_time
-{mapping, "multi_backend.$name.bitcask.expiry.grace_time", "riak_kv.multi_backend", [
- {datatype, {duration, s}},
- {level, advanced},
- {default, 0}
-]}.
-
%% @see bitcask.io_mode
{mapping, "multi_backend.$name.bitcask.io_mode", "riak_kv.multi_backend", [
{default, erlang},
{datatype, {enum, [erlang, nif]}},
- {level, advanced}
+ hidden
]}.
View
22 test/bitcask_schema_tests.erl
@@ -8,7 +8,7 @@
basic_schema_test() ->
lager:start(),
%% The defaults are defined in ../priv/bitcask.schema. it is the file under test.
- Config = cuttlefish_unit:generate_templated_config("../priv/bitcask.schema", [], context()),
+ Config = cuttlefish_unit:generate_templated_config("../priv/bitcask.schema", [], context(), predefined_schema()),
cuttlefish_unit:assert_config(Config, "bitcask.data_root", "./data/bitcask"),
cuttlefish_unit:assert_config(Config, "bitcask.open_timeout", 4),
@@ -40,7 +40,7 @@ merge_window_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()),
+ Config = cuttlefish_unit:generate_templated_config("../priv/bitcask.schema", Conf, context(), predefined_schema()),
cuttlefish_unit:assert_config(Config, "bitcask.data_root", "./data/bitcask"),
cuttlefish_unit:assert_config(Config, "bitcask.open_timeout", 4),
@@ -90,7 +90,7 @@ override_schema_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()),
+ Config = cuttlefish_unit:generate_templated_config("../priv/bitcask.schema", Conf, context(), predefined_schema()),
cuttlefish_unit:assert_config(Config, "bitcask.data_root", "/absolute/data/bitcask"),
cuttlefish_unit:assert_config(Config, "bitcask.open_timeout", 2),
@@ -117,7 +117,15 @@ override_schema_test() ->
%% riak_core's schema file is written with some {{mustache_vars}} for substitution during packaging
%% cuttlefish doesn't have a great time parsing those, so we perform the substitutions first, because
%% that's how it would work in real life.
-context() ->
- [
- {platform_data_dir, "./data"}
- ].
+context() -> [].
+
+%% This predefined schema covers riak_kv's dependency on
+%% platform_data_dir
+predefined_schema() ->
+ Mapping = cuttlefish_mapping:parse({mapping,
+ "platform_data_dir",
+ "riak_core.platform_data_dir", [
+ {default, "./data"},
+ {datatype, directory}
+ ]}),
+ {[], [Mapping], []}.
Please sign in to comment.
Something went wrong with that request. Please try again.