Skip to content

Commit

Permalink
aae_schedulenextrebuild/2
Browse files Browse the repository at this point in the history
  • Loading branch information
hmmr committed Dec 16, 2024
1 parent 6fbf5f2 commit 2cb5947
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/aae_controller.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
aae_start/7,
aae_start/8,
aae_nextrebuild/1,
aae_schedulenextrebuild/2,
aae_put/7,
aae_close/1,
aae_destroy/1,
Expand Down Expand Up @@ -210,6 +211,13 @@ aae_start(
aae_nextrebuild(Pid) ->
gen_server:call(Pid, rebuild_time, ?SYNC_TIMEOUT).

-spec aae_schedulenextrebuild(pid(), non_neg_integer()) -> ok.
%% @doc
%% Schedule the next keystore rebuild, assuming last rebuild
%% occurred now + specified delay
aae_schedulenextrebuild(Pid, Delay) ->
gen_server:call(Pid, {schedule_nextrebuild, Delay}, ?SYNC_TIMEOUT).

-spec aae_put(pid(), responsible_preflist(),
aae_keystore:bucket(), aae_keystore:key(),
version_vector(), version_vector(),
Expand Down Expand Up @@ -578,6 +586,11 @@ init([Opts]) ->

handle_call(rebuild_time, _From, State) ->
{reply, State#state.next_rebuild, State};
handle_call({schedule_rebuild, Delay}, _From, State) ->
{Mega, Sec, Micros} = os:timestamp(),
Next = schedule_rebuild({Mega, Sec + Delay, Micros},
State#state.rebuild_schedule),
{reply, ok, State#state{next_rebuild = Next}};
handle_call(close, _From, State) ->
ok = maybe_flush_puts(State#state.key_store,
State#state.objectspecs_queue,
Expand Down

0 comments on commit 2cb5947

Please sign in to comment.