Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OTP >=24 #253

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix return type issue
shuieryin committed Jun 2, 2017
commit 0b86209790b0278689ccc828957f067f359ce93d
10 changes: 5 additions & 5 deletions src/api/mc_worker_api.erl
Original file line number Diff line number Diff line change
@@ -126,13 +126,13 @@ find_one(Connection, Query) when is_record(Query, query) ->
mc_connection_man:read_one(Connection, Query).

%% @doc Return selected documents.
-spec find(pid(), colldb(), selector()) -> {ok, cursor()} | eof.
-spec find(pid(), colldb(), selector()) -> {ok, cursor()} | [].
find(Connection, Coll, Selector) ->
find(Connection, Coll, Selector, #{}).

%% @doc Return projection of selected documents.
%% Empty projection [] means full projection.
-spec find(pid(), colldb(), selector(), map()) -> {ok, cursor()} | eof.
-spec find(pid(), colldb(), selector(), map()) -> {ok, cursor()} | [].
find(Connection, Coll, Selector, Args) ->
Projector = maps:get(projector, Args, #{}),
Skip = maps:get(skip, Args, 0),
@@ -149,11 +149,11 @@ find(Connection, Coll, Selector, Args) ->
sok_overriden = true
}).

-spec find(pid() | atom(), query()) -> {ok, cursor()} | eof.
-spec find(pid() | atom(), query()) -> {ok, cursor()} | [].
find(Connection, Query) when is_record(Query, query) ->
case mc_connection_man:read(Connection, Query) of
eof -> eof;
Cursor when is_pid(Cursor) ->
[] -> [];
{ok, Cursor} when is_pid(Cursor) ->
{ok, Cursor}
end.

4 changes: 2 additions & 2 deletions src/connection/mc_connection_man.erl
Original file line number Diff line number Diff line change
@@ -19,11 +19,11 @@
-export([request_worker/2, process_reply/2]).
-export([read/2, read_one/2, read_one_sync/4]).

-spec read(pid() | atom(), query()) -> eof | pid().
-spec read(pid() | atom(), query()) -> [] | {ok, pid()}.
read(Connection, Request = #'query'{collection = Collection, batchsize = BatchSize}) ->
case request_worker(Connection, Request) of
{_, []} ->
eof;
[];
{Cursor, Batch} ->
mc_cursor:start_link(Connection, Collection, Cursor, BatchSize, Batch)
end.