11 Appendix C: Fragmented Table Hashing Callback Interface
11.1 mnesia_frag_hash Callback Behavior
-module(mnesia_frag_hash).
%% Fragmented Table Hashing callback functions
-export([
init_state/2,
add_frag/1,
del_frag/1,
key_to_frag_number/2,
match_spec_to_frag_numbers/2
]).
-record(hash_state,
{n_fragments,
next_n_to_split,
n_doubles,
function}).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
init_state(_Tab, State) when State == undefined ->
#hash_state{n_fragments = 1,
next_n_to_split = 1,
n_doubles = 0,
function = phash2}.
convert_old_state({hash_state, N, P, L}) ->
#hash_state{n_fragments = N,
next_n_to_split = P,
n_doubles = L,
function = phash}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
add_frag(#hash_state{next_n_to_split = SplitN, n_do