Skip to content

Commit

Permalink
Merge pull request #116 from inaka/cabolanos.110.remove_delete_functi…
Browse files Browse the repository at this point in the history
…on_and_callback_from_sumo_store

[Fixed #110] Remove delete function and callback from sumo_store.
  • Loading branch information
Brujo Benavides committed Feb 19, 2015
2 parents 1901b1d + 8dda70f commit 36aa993
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/sumo_store.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
-export([start_link/3]).
-export([create_schema/2]).
-export([persist/2]).
-export([delete/3, delete_by/3, delete_all/2]).
-export([delete_by/3, delete_all/2]).
-export([find_all/2, find_all/5, find_by/3, find_by/5, find_by/6]).
-export([call/4]).

Expand Down Expand Up @@ -66,8 +66,6 @@
-callback init(term()) -> {ok, term()}.
-callback persist(sumo_internal:doc(), State) ->
result(sumo_internal:doc(), State).
-callback delete(sumo:schema_name(), sumo:field_value(), State) ->
result(affected_rows(), State).
-callback delete_by(sumo:schema_name(), sumo:conditions(), State) ->
result(affected_rows(), State).
-callback delete_all(sumo:schema_name(), State) ->
Expand Down Expand Up @@ -115,13 +113,6 @@ create_schema(Name, Schema) ->
persist(Name, Doc) ->
wpool:call(Name, {persist, Doc}).

%% @doc Deletes the doc identified by id in the given store name.
-spec delete(
atom(), sumo:schema_name(), sumo:field_value()
) -> ok | {error, term()}.
delete(Name, DocName, Id) ->
wpool:call(Name, {delete, DocName, Id}).

%% @doc Deletes the docs identified by the given conditions.
-spec delete_by(
atom(), sumo:schema_name(), sumo:conditions()
Expand Down Expand Up @@ -212,13 +203,6 @@ handle_call(
{OkOrError, Reply, NewState} = Handler:persist(Doc, HState),
{reply, {OkOrError, Reply}, State#state{handler_state=NewState}};

handle_call(
{delete, DocName, Id}, _From,
#state{handler = Handler, handler_state = HState} = State
) ->
{OkOrError, Reply, NewState} = Handler:delete(DocName, Id, HState),
{reply, {OkOrError, Reply}, State#state{handler_state=NewState}};

handle_call(
{delete_by, DocName, Conditions}, _From,
#state{handler = Handler, handler_state = HState} = State
Expand Down

0 comments on commit 36aa993

Please sign in to comment.