Use the partitioning access functions for mnesia.

main
absc 2024-10-11 20:25:58 +00:00
parent 3c40cc381e
commit cbdbdb6c32
1 changed files with 5 additions and 5 deletions

View File

@ -709,7 +709,7 @@ handle_call({read, Bucket, Key}, _From, State) ->
mnesia:read(Bucket, Key) mnesia:read(Bucket, Key)
end, end,
case mnesia:transaction(F) of case mnesia:activity(transaction, F, [], mnesia_frag) of
{atomic, R} -> {reply, {ok, R}, State}; {atomic, R} -> {reply, {ok, R}, State};
{aborted, Reason} -> {reply, {error, Reason}, State} {aborted, Reason} -> {reply, {error, Reason}, State}
end; end;
@ -723,7 +723,7 @@ handle_call({delete, Bucket, Key}, _From, State) ->
mnesia:delete({Bucket, Key}) mnesia:delete({Bucket, Key})
end, end,
case mnesia:transaction(F) of case mnesia:activity(transaction, F, [], mnesia_frag) of
{atomic, ok} -> {reply, ok, State}; {atomic, ok} -> {reply, ok, State};
{aborted, Reason} -> {reply, {error, Reason}, State} {aborted, Reason} -> {reply, {error, Reason}, State}
end; end;
@ -737,7 +737,7 @@ handle_call({delete_set, Bucket, Metadata}, _From, State) ->
delete_matching(Bucket, Recs) delete_matching(Bucket, Recs)
end, end,
case mnesia:transaction(F) of case mnesia:activity(transaction, F, [], mnesia_frag) of
{atomic, ok} -> {reply, ok, State}; {atomic, ok} -> {reply, ok, State};
{aborted, Reason} -> {reply, {error, Reason}, State} {aborted, Reason} -> {reply, {error, Reason}, State}
end; end;
@ -751,7 +751,7 @@ handle_call({write, Bucket, Key, Term, Metadata}, _From, State) ->
mnesia:write(Bucket, R, write) mnesia:write(Bucket, R, write)
end, end,
case mnesia:transaction(F) of case mnesia:activity(transaction, F, [], mnesia_frag) of
{atomic, _} -> {reply, ok, State}; {atomic, _} -> {reply, ok, State};
{aborted, Reason} -> {reply, {error, Reason}, State} {aborted, Reason} -> {reply, {error, Reason}, State}
end. end.
@ -806,7 +806,7 @@ search(Bucket, Metadata) ->
qlc:e(Q) qlc:e(Q)
end, end,
case mnesia:transaction(F) of case mnesia:activity(transaction, F, [], mnesia_frag) of
{atomic, L} -> {ok, L}; {atomic, L} -> {ok, L};
{aborted, Reason} -> {error, Reason} {aborted, Reason} -> {error, Reason}
end. end.