Skip to content

Commit

Permalink
getters of various fields needed for riak admin aae-progress-report
Browse files Browse the repository at this point in the history
  • Loading branch information
hmmr committed Dec 19, 2024
1 parent 2cb5947 commit e3d7ee7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/aae_controller.erl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
hash_clocks/2,
wrapped_splitobjfun/1]).

-export([get_key_store/1,
get_next_rebuild/1,
get_tree_caches/1]).

-export([wait_on_sync/5]).

-export([generate_returnfun/2]).
Expand Down Expand Up @@ -1371,6 +1375,24 @@ preflist_wrapper_fun(FoldObjectsFun, IndexNs) ->
end
end.

-spec get_key_store(#state{}) -> pid() | undefined.
%% @doc
%% Expose key_store pid, to gather info for aae-progress-report.
get_key_store(#state{key_store = A}) ->
A.

-spec get_next_rebuild(#state{}) -> erlang:timestamp() | undefined.
%% @doc
%% Expose next_rebuild field, to gather info for aae-progress-report.
get_next_rebuild(#state{next_rebuild = A}) ->
A.

-spec get_tree_caches(#state{}) -> tree_caches().
%% @doc
%% Expose tree_cahches field, to gather info for aae-progress-report.
get_tree_caches(#state{tree_caches = A}) ->
A.


%%%============================================================================
%%% Test
Expand Down
10 changes: 9 additions & 1 deletion src/aae_keystore.erl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
generate_treesegment/1,
value/3]).

-export([get_last_rebuild/1]).

-record(state, {vnode :: pid()|undefined,
store :: pid()|undefined,
id = key_store :: any(),
Expand Down Expand Up @@ -1291,6 +1293,12 @@ disklog_filename(RootPath, GUID) ->
filename:join(RootPath, GUID ++ ?DISKLOG_EXT).


-spec get_last_rebuild(#state{}) -> erlang:timestamp() | never.
%% @doc
%% Expose last_rebuild field (used in generation of aae-progress-report).
get_last_rebuild(#state{last_rebuild = A}) ->
A.


%%%============================================================================
%%% Test
Expand Down Expand Up @@ -1859,4 +1867,4 @@ generate_objectspecs(Op, B, KeyList) ->



-endif.
-endif.
10 changes: 9 additions & 1 deletion src/aae_treecache.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
cache_loglevel/2,
cache_close/1]).

-export([dirty_segment_count/1]).

-define(PENDING_EXT, ".pnd").
-define(FINAL_EXT, ".aae").
-define(START_SQN, 1).
Expand Down Expand Up @@ -450,6 +452,12 @@ binary_extractfun(Key, {CurrentHash, OldHash}) ->
end,
{Key, {is_hash, CurrentHash bxor RemoveH}}.

-spec dirty_segment_count(#state{}) -> non_neg_integer().
%% @doc
%% Expose dirty_segments length, for aae-progress-report.
dirty_segment_count(#state{dirty_segments = A}) ->
length(A).

%%%============================================================================
%%% Test
%%%============================================================================
Expand Down Expand Up @@ -826,4 +834,4 @@ test_setup_funs(InitialKeys) ->
{AddFun, AlterFun, RemoveFun}.


-endif.
-endif.

0 comments on commit e3d7ee7

Please sign in to comment.