Permalink
Browse files

initial import

  • Loading branch information...
0 parents commit 90f6ce85fb18af204004c738b3878c579612c923 @argv0 argv0 committed Jul 21, 2010
Showing with 7,447 additions and 0 deletions.
  1. +31 −0 Makefile
  2. +90 −0 ebin/riak_core.app
  3. +5 −0 include/riak_core_handoff.hrl
  4. +24 −0 include/riak_core_vnode.hrl
  5. BIN rebar
  6. +6 −0 rebar.config
  7. +51 −0 src/app_helper.erl
  8. +189 −0 src/bloom.erl
  9. +214 −0 src/chash.erl
  10. +165 −0 src/gen_nb_server.erl
  11. +1,026 −0 src/gen_server2.erl
  12. +69 −0 src/json_pp.erl
  13. +367 −0 src/merkerl.erl
  14. +221 −0 src/priority_queue.erl
  15. +40 −0 src/process_proxy.erl
  16. +49 −0 src/riak_core.erl
  17. +6 −0 src/riak_core.proto
  18. +142 −0 src/riak_core_apl.erl
  19. +72 −0 src/riak_core_app.erl
  20. +101 −0 src/riak_core_bucket.erl
  21. +261 −0 src/riak_core_claim.erl
  22. +251 −0 src/riak_core_gossip.erl
  23. +60 −0 src/riak_core_handoff_listener.erl
  24. +77 −0 src/riak_core_handoff_manager.erl
  25. +88 −0 src/riak_core_handoff_receiver.erl
  26. +102 −0 src/riak_core_handoff_sender.erl
  27. +394 −0 src/riak_core_node_watcher.erl
  28. +87 −0 src/riak_core_node_watcher_events.erl
  29. +382 −0 src/riak_core_ring.erl
  30. +92 −0 src/riak_core_ring_events.erl
  31. +97 −0 src/riak_core_ring_handler.erl
  32. +254 −0 src/riak_core_ring_manager.erl
  33. +69 −0 src/riak_core_sup.erl
  34. +41 −0 src/riak_core_test_util.erl
  35. +230 −0 src/riak_core_util.erl
  36. +241 −0 src/riak_core_vnode.erl
  37. +214 −0 src/riak_core_vnode_master.erl
  38. +42 −0 src/riak_core_vnode_sup.erl
  39. +49 −0 src/riak_core_web.erl
  40. +336 −0 src/slide.erl
  41. +158 −0 src/spiraltime.erl
  42. +270 −0 src/vclock.erl
  43. +225 −0 test/core_vnode_eqc.erl
  44. +99 −0 test/mock_vnode.erl
  45. +460 −0 test/node_watcher_qc.erl
@@ -0,0 +1,31 @@
+
+
+.PHONY: deps
+
+all: deps compile
+
+compile:
+ ./rebar compile
+
+deps:
+ ./rebar get-deps
+
+clean:
+ ./rebar clean
+
+distclean: clean
+ ./rebar delete-deps
+
+eunit:
+ ./rebar skip_deps=true eunit
+
+docs:
+ ./rebar skip_deps=true doc
+ @cp -R apps/luke/doc doc/luke
+ @cp -R apps/riak_core/doc doc/riak_core
+ @cp -R apps/riak_kv/doc doc/riak_kv
+
+dialyzer: compile
+ @dialyzer -Wno_return -c apps/riak_core/ebin
+
+
@@ -0,0 +1,90 @@
+%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
+%% ex: ts=4 sw=4 et
+{application, riak_core,
+ [
+ {description, "Riak Core"},
+ {vsn, "0.12.0"},
+ {modules, [
+ app_helper,
+ bloom,
+ chash,
+ gen_nb_server,
+ gen_server2,
+ json_pp,
+ merkerl,
+ priority_queue,
+ process_proxy,
+ riak_core,
+ riak_core_apl,
+ riak_core_app,
+ riak_core_bucket,
+ riak_core_claim,
+ riak_core_gossip,
+ riak_core_handoff_listener,
+ riak_core_handoff_manager,
+ riak_core_handoff_receiver,
+ riak_core_handoff_sender,
+ riak_core_node_watcher,
+ riak_core_node_watcher_events,
+ riak_core_pb,
+ riak_core_ring,
+ riak_core_ring_events,
+ riak_core_ring_handler,
+ riak_core_ring_manager,
+ riak_core_sup,
+ riak_core_test_util,
+ riak_core_util,
+ riak_core_vnode,
+ riak_core_vnode_master,
+ riak_core_vnode_sup,
+ riak_core_web,
+ slide,
+ spiraltime,
+ vclock
+ ]},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib,
+ sasl,
+ crypto,
+ webmachine
+ ]},
+ {mod, { riak_core_app, []}},
+ {env, [
+ %% Cluster name
+ {cluster_name, "default"},
+
+ %% Default location of ringstate
+ {ring_state_dir, "data/ring"},
+
+ %% Default ring creation size. Make sure it is a power of 2,
+ %% e.g. 16, 32, 64, 128, 256, 512 etc
+ {ring_creation_size, 64},
+
+ %% Default gossip interval (milliseconds)
+ {gossip_interval, 60000},
+
+ %% Target N value
+ {target_n_val, 4},
+
+ %% Default claims functions
+ {wants_claim_fun, {riak_core_claim, default_wants_claim}},
+ {choose_claim_fun, {riak_core_claim, default_choose_claim}},
+
+ %% Default bucket props
+ {default_bucket_props, [{n_val,3},
+ {allow_mult,false},
+ {last_write_wins,false},
+ {precommit, []},
+ {postcommit, []},
+ {chash_keyfun, {riak_core_util, chash_std_keyfun}}]},
+
+ %% Number of VNodes allowed to do handoff concurrently.
+ {handoff_concurrency, 4},
+
+ %% Handoff IP/port
+ {handoff_port, 8099},
+ {handoff_ip, "0.0.0.0"}
+ ]}
+ ]}.
@@ -0,0 +1,5 @@
+-define(PT_MSG_INIT, 0).
+-define(PT_MSG_OBJ, 1).
+-define(PT_MSG_OLDSYNC, 2).
+-define(PT_MSG_SYNC, 3).
+-define(PT_MSG_CONFIGURE, 4).
@@ -0,0 +1,24 @@
+-type sender_type() :: fsm | server | raw.
+-type sender() :: {sender_type(), reference(), pid()} |
+ %% TODO: Double-check that these special cases are kosher
+ {server, undefined, undefined} | % special case in
+ % riak_core_vnode_master.erl
+ {fsm, undefined, pid()} | % special case in
+ % riak_kv_util:make_request/2.erl
+ ignore | noreply.
+-type partition() :: non_neg_integer().
+-type vnode_req() :: term().
+
+-record(riak_vnode_req_v1, {
+ index :: partition(),
+ sender=noreply :: sender(),
+ request :: vnode_req()}).
+
+
+-record(riak_core_fold_req_v1, {
+ foldfun :: fun(),
+ acc0 :: term()}).
+
+-define(VNODE_REQ, #riak_vnode_req_v1).
+-define(FOLD_REQ, #riak_core_fold_req_v1).
+
BIN rebar
Binary file not shown.
@@ -0,0 +1,6 @@
+{lib_dirs, [".."]}.
+{erl_first_files, ["src/gen_nb_server.erl", "src/gen_server2.erl"]}.
+{cover_enabled, true}.
+{deps, [
+ {protobuffs, "0.5.0", {hg, "http://bitbucket.org/basho/protobuffs", "protobuffs-0.5.0"}}
+ ]}.
@@ -0,0 +1,51 @@
+%% -------------------------------------------------------------------
+%%
+%% riak_core: Core Riak Application
+%%
+%% Copyright (c) 2007-2010 Basho Technologies, Inc. All Rights Reserved.
+%%
+%% This file is provided to you under the Apache License,
+%% Version 2.0 (the "License"); you may not use this file
+%% except in compliance with the License. You may obtain
+%% a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing,
+%% software distributed under the License is distributed on an
+%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+%% KIND, either express or implied. See the License for the
+%% specific language governing permissions and limitations
+%% under the License.
+%%
+%% -------------------------------------------------------------------
+
+-module(app_helper).
+
+-export([get_env/1, get_env/2, get_env/3]).
+
+%% ===================================================================
+%% Public API
+%% ===================================================================
+
+%% @spec get_env(App :: atom()) -> [{Key :: atom(), Value :: term()}]
+%% @doc Retrieve all Key/Value pairs in the env for the specified app.
+get_env(App) ->
+ application:get_all_env(App).
+
+%% @spec get_env(App :: atom(), Key :: atom()) -> term()
+%% @doc The official way to get a value from the app's env.
+%% Will return the 'undefined' atom if that key is unset.
+get_env(App, Key) ->
+ get_env(App, Key, undefined).
+
+%% @spec get_env(App :: atom(), Key :: atom(), Default :: term()) -> term()
+%% @doc The official way to get a value from this application's env.
+%% Will return Default if that key is unset.
+get_env(App, Key, Default) ->
+ case application:get_env(App, Key) of
+ {ok, Value} ->
+ Value;
+ _ ->
+ Default
+ end.
Oops, something went wrong.

1 comment on commit 90f6ce8

Contributor

argv0 commented on 90f6ce8 Jun 13, 2014

cool import bro

Please sign in to comment.