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
|
||||
|
||||
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(),
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
-ifdef(fsm_deprecated).
|
||||
-compile({nowarn_deprecated_function,
|
||||
[{gen_fsm, start, 3},
|
||||
[{gen_fsm, start_link, 3},
|
||||
{gen_fsm, sync_send_event, 3},
|
||||
{gen_fsm, sync_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)
|
||||
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, Pid}.
|
||||
|
||||
|
@ -177,7 +177,9 @@ cdb_open_writer(Filename, Opts) ->
|
|||
%% determine when scans over a file have completed.
|
||||
cdb_reopen_reader(Filename, LastKey, CDBopts) ->
|
||||
{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,
|
||||
{open_reader, Filename, LastKey},
|
||||
infinity),
|
||||
|
@ -198,7 +200,7 @@ cdb_open_reader(Filename) ->
|
|||
%% to discover the LastKey.
|
||||
%% Allows non-default cdb_options to be passed
|
||||
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, Pid}.
|
||||
|
||||
|
@ -2459,7 +2461,7 @@ safe_read_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),
|
||||
?assertMatch({next_state, reader, #state{}}, handle_info(nonsense,
|
||||
reader,
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
%% @doc
|
||||
%% Generate a new clerk
|
||||
clerk_new(InkerClerkOpts) ->
|
||||
gen_server:start(?MODULE, [InkerClerkOpts], []).
|
||||
gen_server:start_link(?MODULE, [InkerClerkOpts], []).
|
||||
|
||||
-spec clerk_compact(pid(), pid(),
|
||||
fun(), fun(), fun(),
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
%% The inker will need to know what the reload strategy is, to inform the
|
||||
%% clerk about the rules to enforce during compaction.
|
||||
ink_start(InkerOpts) ->
|
||||
gen_server:start(?MODULE, [InkerOpts], []).
|
||||
gen_server:start_link(?MODULE, [InkerOpts], []).
|
||||
|
||||
-spec ink_put(pid(),
|
||||
leveled_codec:ledger_key(),
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
clerk_new(Owner, Manifest, CompressionMethod) ->
|
||||
{ok, Pid} =
|
||||
gen_server:start(?MODULE,
|
||||
gen_server:start_link(?MODULE,
|
||||
[{compression_method, CompressionMethod}],
|
||||
[]),
|
||||
ok = gen_server:call(Pid, {load, Owner, Manifest}, infinity),
|
||||
|
|
|
@ -308,7 +308,7 @@
|
|||
%% query is run against the level zero space and just the query results are
|
||||
%5 copied into the clone.
|
||||
pcl_start(PCLopts) ->
|
||||
gen_server:start(?MODULE, [PCLopts], []).
|
||||
gen_server:start_link(?MODULE, [PCLopts], []).
|
||||
|
||||
-spec pcl_pushmem(pid(), bookies_memory()) -> ok|returned.
|
||||
%% @doc
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
-ifdef(fsm_deprecated).
|
||||
-compile({nowarn_deprecated_function,
|
||||
[{gen_fsm, start, 3},
|
||||
[{gen_fsm, start_link, 3},
|
||||
{gen_fsm, sync_send_event, 3},
|
||||
{gen_fsm, send_event, 2},
|
||||
{gen_fsm, send_all_state_event, 2}]}).
|
||||
|
@ -209,7 +209,7 @@
|
|||
%%
|
||||
%% The filename should include the file extension.
|
||||
sst_open(RootPath, Filename) ->
|
||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
||||
{ok, Pid} = gen_fsm:start_link(?MODULE, [], []),
|
||||
case gen_fsm:sync_send_event(Pid,
|
||||
{sst_open, RootPath, Filename},
|
||||
infinity) of
|
||||
|
@ -228,7 +228,7 @@ sst_open(RootPath, Filename) ->
|
|||
%% pairs. This should not be used for basement levels or unexpanded Key/Value
|
||||
%% lists as merge_lists will not be called.
|
||||
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),
|
||||
{[], [], SlotList, FK} = merge_lists(KVList, PressMethod0),
|
||||
case gen_fsm:sync_send_event(Pid,
|
||||
|
@ -276,7 +276,7 @@ sst_new(RootPath, Filename,
|
|||
[] ->
|
||||
empty;
|
||||
_ ->
|
||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
||||
{ok, Pid} = gen_fsm:start_link(?MODULE, [], []),
|
||||
case gen_fsm:sync_send_event(Pid,
|
||||
{sst_new,
|
||||
RootPath,
|
||||
|
@ -303,7 +303,7 @@ sst_newlevelzero(RootPath, Filename,
|
|||
Slots, FetchFun, Penciller,
|
||||
MaxSQN, PressMethod) ->
|
||||
PressMethod0 = compress_level(0, PressMethod),
|
||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
||||
{ok, Pid} = gen_fsm:start_link(?MODULE, [], []),
|
||||
gen_fsm:send_event(Pid,
|
||||
{sst_newlevelzero,
|
||||
RootPath,
|
||||
|
@ -2802,7 +2802,7 @@ key_dominates_test() ->
|
|||
key_dominates([KV7|KL2], [KV2], {true, 1})).
|
||||
|
||||
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),
|
||||
?assertMatch({next_state, reader, #state{}}, handle_info(nonsense,
|
||||
reader,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue