Switch to start_link
Start all processes linked - to collapse the whole tree if one process fails
This commit is contained in:
parent
92bd2513c1
commit
082eabb65b
7 changed files with 20 additions and 18 deletions
|
@ -315,7 +315,7 @@ book_start(RootPath, LedgerCacheSize, JournalSize, SyncStrategy) ->
|
||||||
%% comments on the open_options() type
|
%% comments on the open_options() type
|
||||||
|
|
||||||
book_start(Opts) ->
|
book_start(Opts) ->
|
||||||
gen_server:start(?MODULE, [set_defaults(Opts)], []).
|
gen_server:start_link(?MODULE, [set_defaults(Opts)], []).
|
||||||
|
|
||||||
|
|
||||||
-spec book_tempput(pid(), any(), any(), any(),
|
-spec book_tempput(pid(), any(), any(), any(),
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
-ifdef(fsm_deprecated).
|
-ifdef(fsm_deprecated).
|
||||||
-compile({nowarn_deprecated_function,
|
-compile({nowarn_deprecated_function,
|
||||||
[{gen_fsm, start, 3},
|
[{gen_fsm, start_link, 3},
|
||||||
{gen_fsm, sync_send_event, 3},
|
{gen_fsm, sync_send_event, 3},
|
||||||
{gen_fsm, sync_send_event, 2},
|
{gen_fsm, sync_send_event, 2},
|
||||||
{gen_fsm, send_event, 2},
|
{gen_fsm, send_event, 2},
|
||||||
|
@ -162,7 +162,7 @@ cdb_open_writer(Filename) ->
|
||||||
%% hashtree cached in memory (the file will need to be scanned to build the
|
%% hashtree cached in memory (the file will need to be scanned to build the
|
||||||
%% hashtree)
|
%% hashtree)
|
||||||
cdb_open_writer(Filename, Opts) ->
|
cdb_open_writer(Filename, Opts) ->
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [Opts], []),
|
{ok, Pid} = gen_fsm:start_link(?MODULE, [Opts], []),
|
||||||
ok = gen_fsm:sync_send_event(Pid, {open_writer, Filename}, infinity),
|
ok = gen_fsm:sync_send_event(Pid, {open_writer, Filename}, infinity),
|
||||||
{ok, Pid}.
|
{ok, Pid}.
|
||||||
|
|
||||||
|
@ -177,7 +177,9 @@ cdb_open_writer(Filename, Opts) ->
|
||||||
%% determine when scans over a file have completed.
|
%% determine when scans over a file have completed.
|
||||||
cdb_reopen_reader(Filename, LastKey, CDBopts) ->
|
cdb_reopen_reader(Filename, LastKey, CDBopts) ->
|
||||||
{ok, Pid} =
|
{ok, Pid} =
|
||||||
gen_fsm:start(?MODULE, [CDBopts#cdb_options{binary_mode=true}], []),
|
gen_fsm:start_link(?MODULE,
|
||||||
|
[CDBopts#cdb_options{binary_mode=true}],
|
||||||
|
[]),
|
||||||
ok = gen_fsm:sync_send_event(Pid,
|
ok = gen_fsm:sync_send_event(Pid,
|
||||||
{open_reader, Filename, LastKey},
|
{open_reader, Filename, LastKey},
|
||||||
infinity),
|
infinity),
|
||||||
|
@ -198,7 +200,7 @@ cdb_open_reader(Filename) ->
|
||||||
%% to discover the LastKey.
|
%% to discover the LastKey.
|
||||||
%% Allows non-default cdb_options to be passed
|
%% Allows non-default cdb_options to be passed
|
||||||
cdb_open_reader(Filename, Opts) ->
|
cdb_open_reader(Filename, Opts) ->
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [Opts], []),
|
{ok, Pid} = gen_fsm:start_link(?MODULE, [Opts], []),
|
||||||
ok = gen_fsm:sync_send_event(Pid, {open_reader, Filename}, infinity),
|
ok = gen_fsm:sync_send_event(Pid, {open_reader, Filename}, infinity),
|
||||||
{ok, Pid}.
|
{ok, Pid}.
|
||||||
|
|
||||||
|
@ -2459,7 +2461,7 @@ safe_read_test() ->
|
||||||
|
|
||||||
|
|
||||||
nonsense_coverage_test() ->
|
nonsense_coverage_test() ->
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [#cdb_options{}], []),
|
{ok, Pid} = gen_fsm:start_link(?MODULE, [#cdb_options{}], []),
|
||||||
ok = gen_fsm:send_all_state_event(Pid, nonsense),
|
ok = gen_fsm:send_all_state_event(Pid, nonsense),
|
||||||
?assertMatch({next_state, reader, #state{}}, handle_info(nonsense,
|
?assertMatch({next_state, reader, #state{}}, handle_info(nonsense,
|
||||||
reader,
|
reader,
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
%% @doc
|
%% @doc
|
||||||
%% Generate a new clerk
|
%% Generate a new clerk
|
||||||
clerk_new(InkerClerkOpts) ->
|
clerk_new(InkerClerkOpts) ->
|
||||||
gen_server:start(?MODULE, [InkerClerkOpts], []).
|
gen_server:start_link(?MODULE, [InkerClerkOpts], []).
|
||||||
|
|
||||||
-spec clerk_compact(pid(), pid(),
|
-spec clerk_compact(pid(), pid(),
|
||||||
fun(), fun(), fun(),
|
fun(), fun(), fun(),
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
%% The inker will need to know what the reload strategy is, to inform the
|
%% The inker will need to know what the reload strategy is, to inform the
|
||||||
%% clerk about the rules to enforce during compaction.
|
%% clerk about the rules to enforce during compaction.
|
||||||
ink_start(InkerOpts) ->
|
ink_start(InkerOpts) ->
|
||||||
gen_server:start(?MODULE, [InkerOpts], []).
|
gen_server:start_link(?MODULE, [InkerOpts], []).
|
||||||
|
|
||||||
-spec ink_put(pid(),
|
-spec ink_put(pid(),
|
||||||
leveled_codec:ledger_key(),
|
leveled_codec:ledger_key(),
|
||||||
|
|
|
@ -59,9 +59,9 @@
|
||||||
|
|
||||||
clerk_new(Owner, Manifest, CompressionMethod) ->
|
clerk_new(Owner, Manifest, CompressionMethod) ->
|
||||||
{ok, Pid} =
|
{ok, Pid} =
|
||||||
gen_server:start(?MODULE,
|
gen_server:start_link(?MODULE,
|
||||||
[{compression_method, CompressionMethod}],
|
[{compression_method, CompressionMethod}],
|
||||||
[]),
|
[]),
|
||||||
ok = gen_server:call(Pid, {load, Owner, Manifest}, infinity),
|
ok = gen_server:call(Pid, {load, Owner, Manifest}, infinity),
|
||||||
leveled_log:log("PC001", [Pid, Owner]),
|
leveled_log:log("PC001", [Pid, Owner]),
|
||||||
{ok, Pid}.
|
{ok, Pid}.
|
||||||
|
|
|
@ -308,7 +308,7 @@
|
||||||
%% query is run against the level zero space and just the query results are
|
%% query is run against the level zero space and just the query results are
|
||||||
%5 copied into the clone.
|
%5 copied into the clone.
|
||||||
pcl_start(PCLopts) ->
|
pcl_start(PCLopts) ->
|
||||||
gen_server:start(?MODULE, [PCLopts], []).
|
gen_server:start_link(?MODULE, [PCLopts], []).
|
||||||
|
|
||||||
-spec pcl_pushmem(pid(), bookies_memory()) -> ok|returned.
|
-spec pcl_pushmem(pid(), bookies_memory()) -> ok|returned.
|
||||||
%% @doc
|
%% @doc
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
-ifdef(fsm_deprecated).
|
-ifdef(fsm_deprecated).
|
||||||
-compile({nowarn_deprecated_function,
|
-compile({nowarn_deprecated_function,
|
||||||
[{gen_fsm, start, 3},
|
[{gen_fsm, start_link, 3},
|
||||||
{gen_fsm, sync_send_event, 3},
|
{gen_fsm, sync_send_event, 3},
|
||||||
{gen_fsm, send_event, 2},
|
{gen_fsm, send_event, 2},
|
||||||
{gen_fsm, send_all_state_event, 2}]}).
|
{gen_fsm, send_all_state_event, 2}]}).
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
%%
|
%%
|
||||||
%% The filename should include the file extension.
|
%% The filename should include the file extension.
|
||||||
sst_open(RootPath, Filename) ->
|
sst_open(RootPath, Filename) ->
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
{ok, Pid} = gen_fsm:start_link(?MODULE, [], []),
|
||||||
case gen_fsm:sync_send_event(Pid,
|
case gen_fsm:sync_send_event(Pid,
|
||||||
{sst_open, RootPath, Filename},
|
{sst_open, RootPath, Filename},
|
||||||
infinity) of
|
infinity) of
|
||||||
|
@ -228,7 +228,7 @@ sst_open(RootPath, Filename) ->
|
||||||
%% pairs. This should not be used for basement levels or unexpanded Key/Value
|
%% pairs. This should not be used for basement levels or unexpanded Key/Value
|
||||||
%% lists as merge_lists will not be called.
|
%% lists as merge_lists will not be called.
|
||||||
sst_new(RootPath, Filename, Level, KVList, MaxSQN, PressMethod) ->
|
sst_new(RootPath, Filename, Level, KVList, MaxSQN, PressMethod) ->
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
{ok, Pid} = gen_fsm:start_link(?MODULE, [], []),
|
||||||
PressMethod0 = compress_level(Level, PressMethod),
|
PressMethod0 = compress_level(Level, PressMethod),
|
||||||
{[], [], SlotList, FK} = merge_lists(KVList, PressMethod0),
|
{[], [], SlotList, FK} = merge_lists(KVList, PressMethod0),
|
||||||
case gen_fsm:sync_send_event(Pid,
|
case gen_fsm:sync_send_event(Pid,
|
||||||
|
@ -276,7 +276,7 @@ sst_new(RootPath, Filename,
|
||||||
[] ->
|
[] ->
|
||||||
empty;
|
empty;
|
||||||
_ ->
|
_ ->
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
{ok, Pid} = gen_fsm:start_link(?MODULE, [], []),
|
||||||
case gen_fsm:sync_send_event(Pid,
|
case gen_fsm:sync_send_event(Pid,
|
||||||
{sst_new,
|
{sst_new,
|
||||||
RootPath,
|
RootPath,
|
||||||
|
@ -303,7 +303,7 @@ sst_newlevelzero(RootPath, Filename,
|
||||||
Slots, FetchFun, Penciller,
|
Slots, FetchFun, Penciller,
|
||||||
MaxSQN, PressMethod) ->
|
MaxSQN, PressMethod) ->
|
||||||
PressMethod0 = compress_level(0, PressMethod),
|
PressMethod0 = compress_level(0, PressMethod),
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
{ok, Pid} = gen_fsm:start_link(?MODULE, [], []),
|
||||||
gen_fsm:send_event(Pid,
|
gen_fsm:send_event(Pid,
|
||||||
{sst_newlevelzero,
|
{sst_newlevelzero,
|
||||||
RootPath,
|
RootPath,
|
||||||
|
@ -2802,7 +2802,7 @@ key_dominates_test() ->
|
||||||
key_dominates([KV7|KL2], [KV2], {true, 1})).
|
key_dominates([KV7|KL2], [KV2], {true, 1})).
|
||||||
|
|
||||||
nonsense_coverage_test() ->
|
nonsense_coverage_test() ->
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
{ok, Pid} = gen_fsm:start_link(?MODULE, [], []),
|
||||||
ok = gen_fsm:send_all_state_event(Pid, nonsense),
|
ok = gen_fsm:send_all_state_event(Pid, nonsense),
|
||||||
?assertMatch({next_state, reader, #state{}}, handle_info(nonsense,
|
?assertMatch({next_state, reader, #state{}}, handle_info(nonsense,
|
||||||
reader,
|
reader,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue