diff --git a/storage/src/storage.erl b/storage/src/storage.erl index d14cc39..5c7705f 100644 --- a/storage/src/storage.erl +++ b/storage/src/storage.erl @@ -709,10 +709,7 @@ handle_call({read, Bucket, Key}, _From, State) -> mnesia:read(Bucket, Key) end, - case mnesia:activity(transaction, F, [], mnesia_frag) of - {atomic, R} -> {reply, {ok, R}, State}; - {aborted, Reason} -> {reply, {error, Reason}, State} - end; + {reply, mnesia:activity(transaction, F, [], mnesia_frag), State}; % % Write callbacks. @@ -723,10 +720,7 @@ handle_call({delete, Bucket, Key}, _From, State) -> mnesia:delete({Bucket, Key}) end, - case mnesia:activity(transaction, F, [], mnesia_frag) of - {atomic, ok} -> {reply, ok, State}; - {aborted, Reason} -> {reply, {error, Reason}, State} - end; + {reply, mnesia:activity(transaction, F, [], mnesia_frag), State}; handle_call({delete_set, Bucket, Metadata}, _From, State) -> Q = qlc:q([X || X <- mnesia:table(Bucket), filter(Metadata, X#object.metadata)]), @@ -737,10 +731,7 @@ handle_call({delete_set, Bucket, Metadata}, _From, State) -> delete_matching(Bucket, Recs) end, - case mnesia:activity(transaction, F, [], mnesia_frag) of - {atomic, ok} -> {reply, ok, State}; - {aborted, Reason} -> {reply, {error, Reason}, State} - end; + {reply, mnesia:activity(transaction, F, [], mnesia_frag), State}; handle_call({write, Bucket, Key, Term}, _From, State) -> handle_call({write, Bucket, Key, Term, []}, _From, State); @@ -751,10 +742,7 @@ handle_call({write, Bucket, Key, Term, Metadata}, _From, State) -> mnesia:write(Bucket, R, write) end, - case mnesia:activity(transaction, F, [], mnesia_frag) of - {atomic, _} -> {reply, ok, State}; - {aborted, Reason} -> {reply, {error, Reason}, State} - end. + {reply, mnesia:activity(transaction, F, [], mnesia_frag), State}. handle_cast(_Msg, State) -> {noreply, State}. @@ -806,10 +794,7 @@ search(Bucket, Metadata) -> qlc:e(Q) end, - case mnesia:activity(transaction, F, [], mnesia_frag) of - {atomic, L} -> {ok, L}; - {aborted, Reason} -> {error, Reason} - end. + {ok, mnesia:activity(transaction, F, [], mnesia_frag)}. % % A record is reported if and only if it contains all the key-value