summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/membership.hrl28
-rw-r--r--src/mem3.erl22
2 files changed, 29 insertions, 21 deletions
diff --git a/include/membership.hrl b/include/membership.hrl
new file mode 100644
index 00000000..52bc4d1a
--- /dev/null
+++ b/include/membership.hrl
@@ -0,0 +1,28 @@
+
+%% version 3 of membership state
+-record(mem, {header=3,
+ nodes=[],
+ clock=[],
+ args
+ }).
+
+%% types
+-type join_type() :: init | join | replace | leave.
+-type join_order() :: non_neg_integer().
+-type options() :: list().
+-type mem_node() :: {join_order(), node(), options()}.
+-type mem_node_list() :: [mem_node()].
+-type arg_options() :: {test, boolean()}.
+-type args() :: [] | [arg_options()].
+-type mem_state() :: #mem{}.
+-type test() :: undefined | node().
+-type epoch() :: float().
+-type clock() :: {node(), epoch()}.
+-type vector_clock() :: [clock()].
+-type ping_node() :: node() | nil.
+
+-type part() :: integer().
+-type ref_node_part() :: {reference(), node(), part()}.
+-type tref() :: reference().
+-type np() :: {node(), part()}.
+-type np_acc() :: [{np(), any()}].
diff --git a/src/mem3.erl b/src/mem3.erl
index a834010a..d5a96605 100644
--- a/src/mem3.erl
+++ b/src/mem3.erl
@@ -34,32 +34,12 @@
terminate/2, code_change/3]).
%% includes
+-include("../include/membership.hrl").
-include_lib("eunit/include/eunit.hrl").
-%% version 3 of membership state
--record(mem, {header=3,
- nodes=[],
- clock=[],
- args
- }).
-
-define(SERVER, membership).
-define(STATE_FILE_PREFIX, "membership").
-%% types - stick somewhere in includes?
--type join_type() :: init | join | replace | leave.
--type join_order() :: non_neg_integer().
--type options() :: list().
--type mem_node() :: {join_order(), node(), options()}.
--type mem_node_list() :: [mem_node()].
--type arg_options() :: {test, boolean()}.
--type args() :: [] | [arg_options()].
--type mem_state() :: #mem{}.
--type test() :: undefined | node().
--type epoch() :: float().
--type clock() :: {node(), epoch()}.
--type vector_clock() :: [clock()].
--type ping_node() :: node() | nil.
%%====================================================================
%% API