10 Appendix B: Activity Access Callback Interface
10.1 mnesia_access Callback Behavior
-module(mnesia_frag).
%% Callback functions when accessed within an activity
-export([
lock/4,
write/5, delete/5, delete_object/5,
read/5, match_object/5, all_keys/4,
select/5,select/6,select_cont/3,
index_match_object/6, index_read/6,
foldl/6, foldr/6, table_info/4,
first/3, next/4, prev/4, last/3,
clear_table/4
]).
%% Callback functions which provides transparent
%% access of fragmented tables from any activity
%% access context.
lock(ActivityId, Opaque, {table , Tab}, LockKind) ->
case frag_names(Tab) of
[Tab] ->
mnesia:lock(ActivityId, Opaque, {table, Tab}, LockKind);
Frags ->
DeepNs = [mnesia:lock(ActivityId, Opaque, {table, F}, LockKind) ||
F <- Frags],
mnesia_lib:uniq(lists:append(DeepNs))
end;
lock(Activity