Skip to content

Commit

Permalink
Restructure default proplist generation to be less ugly, update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
macintux committed Aug 11, 2015
1 parent baa1c0c commit 9b205cf
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/riak_core_bucket_type.erl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,28 @@
%% @doc The hardcoded defaults for all bucket types.
-spec defaults() -> bucket_type_props().
defaults() ->
custom_type_defaults().

%% @doc The hardcoded defaults for the legacy, default bucket
%% type. These find their way into the `default_bucket_props'
%% environment variable
-spec defaults(default_type) -> bucket_type_props().
defaults(default_type) ->
default_type_defaults().

default_type_defaults() ->
common_defaults() ++
[{dvv_enabled, false},
{allow_mult, false}].

custom_type_defaults() ->
common_defaults() ++
%% @HACK dvv is a riak_kv only thing, yet there is nowhere else
%% to put it (except maybe fixups?)
[{dvv_enabled, true},
{allow_mult, true}].

common_defaults() ->
[{linkfun, {modfun, riak_kv_wm_link_walker, mapreduce_linkfun}},
{old_vclock, 86400},
{young_vclock, 20},
Expand All @@ -133,20 +155,11 @@ defaults() ->
{basic_quorum, false},
{notfound_ok, true},
{n_val,3},
{allow_mult, true},
{last_write_wins,false},
{precommit, []},
{postcommit, []},
%% @HACK this is a riak_kv only thing, yet there is nowhere else
%% to put it (except maybe fixups?)
{dvv_enabled, true},
{chash_keyfun, {riak_core_util, chash_std_keyfun}}].

-spec defaults(default_type) -> bucket_type_props().
defaults(default_type) ->
[{allow_mult, false},{dvv_enabled, false}] ++
proplists:delete(allow_mult, proplists:delete(dvv_enabled, defaults())).

%% @doc Create the type. The type is not activated (available to nodes) at this time. This
%% function may be called arbitratily many times if the claimant does not change between
%% calls and the type is not active. An error will also be returned if the properties
Expand Down Expand Up @@ -194,6 +207,9 @@ get(BucketType) when is_binary(BucketType) ->
%% @doc Reset the properties of the bucket. This only affects properties that
%% can be set using {@see update/2} and can only be performed on an active
%% type.
%%
%% This is not currently hooked into `riak-admin' but can be invoked
%% from the console.
-spec reset(bucket_type()) -> ok | {error, term()}.
reset(BucketType) ->
update(BucketType, defaults()).
Expand Down

8 comments on commit 9b205cf

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from mrallen1
at 9b205cf

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/riak_core/bugfix/jrd/727 = 9b205cf into borshop-integration-765-bugfix/jrd/727

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/riak_core/bugfix/jrd/727 = 9b205cf merged ok, testing candidate = 6278eb6

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge sha 6278eb6 is stale.

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging basho/riak_core/bugfix/jrd/727 = 9b205cf into borshop-integration-765-bugfix/jrd/727

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basho/riak_core/bugfix/jrd/727 = 9b205cf merged ok, testing candidate = dce213c

@borshop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding 2.0 to borshop-integration-765-bugfix/jrd/727 = dce213c

Please sign in to comment.