Tidy up spec
Also remove _app _sup originally added for dialyzer (due to false understanding they were needed for dialyzer)
This commit is contained in:
parent
ed869dcada
commit
5cee3a8e4e
4 changed files with 48 additions and 56 deletions
4
rebar.lock
Normal file
4
rebar.lock
Normal file
|
@ -0,0 +1,4 @@
|
|||
[{<<"lz4">>,
|
||||
{git,"https://github.com/martinsumner/erlang-lz4",
|
||||
{ref,"09d539685e616b614e851926384439384601ee5a"}},
|
||||
0}].
|
|
@ -1,19 +0,0 @@
|
|||
-module(leveled_app).
|
||||
|
||||
-behaviour(application).
|
||||
|
||||
%% Application callbacks
|
||||
-export([start/2, stop/1]).
|
||||
|
||||
%% ===================================================================
|
||||
%% Application callbacks
|
||||
%% ===================================================================
|
||||
|
||||
%% Currently this is just to keep dialyzer happy
|
||||
%% Run the store diretcly using leveled_bookie:book_start/4 or bookie_start/1
|
||||
|
||||
start(_StartType, _StartArgs) ->
|
||||
leveled_sup:start_link().
|
||||
|
||||
stop(_State) ->
|
||||
ok.
|
|
@ -104,11 +104,14 @@
|
|||
|
||||
|
||||
-type book_state() :: #state{}.
|
||||
-type sync_mode() :: sync|none|riak_sync.
|
||||
|
||||
%%%============================================================================
|
||||
%%% API
|
||||
%%%============================================================================
|
||||
|
||||
-spec book_start(string(), integer(), integer(), sync_mode()) -> {ok, pid()}.
|
||||
|
||||
%% @doc Start a Leveled Key/Value store - limited options support.
|
||||
%%
|
||||
%% The most common startup parameters are extracted out from the options to
|
||||
|
@ -142,6 +145,8 @@ book_start(RootPath, LedgerCacheSize, JournalSize, SyncStrategy) ->
|
|||
{max_journalsize, JournalSize},
|
||||
{sync_strategy, SyncStrategy}]).
|
||||
|
||||
-spec book_start(list(tuple())) -> {ok, pid()}.
|
||||
|
||||
%% @doc Start a Leveled Key/Value store - full options support.
|
||||
%%
|
||||
%% Allows an options proplists to be passed for setting options. There are
|
||||
|
@ -195,6 +200,10 @@ book_start(RootPath, LedgerCacheSize, JournalSize, SyncStrategy) ->
|
|||
book_start(Opts) ->
|
||||
gen_server:start(?MODULE, [Opts], []).
|
||||
|
||||
|
||||
-spec book_tempput(pid(), any(), any(), any(), list(), atom(), integer()) ->
|
||||
ok|pause.
|
||||
|
||||
%% @doc Put an object with an expiry time
|
||||
%%
|
||||
%% Put an item in the store but with a Time To Live - the time when the object
|
||||
|
@ -258,12 +267,18 @@ book_put(Pid, Bucket, Key, Object, IndexSpecs) ->
|
|||
book_put(Pid, Bucket, Key, Object, IndexSpecs, Tag) ->
|
||||
book_put(Pid, Bucket, Key, Object, IndexSpecs, Tag, infinity).
|
||||
|
||||
-spec book_put(pid(), any(), any(), any(), list(), atom(), infinity|integer())
|
||||
-> ok|pause.
|
||||
|
||||
book_put(Pid, Bucket, Key, Object, IndexSpecs, Tag, TTL) ->
|
||||
gen_server:call(Pid,
|
||||
{put, Bucket, Key, Object, IndexSpecs, Tag, TTL},
|
||||
infinity).
|
||||
|
||||
%% @doc - Standard PUT
|
||||
|
||||
-spec book_delete(pid(), any(), any(), list()) -> ok|pause.
|
||||
|
||||
%% @doc
|
||||
%%
|
||||
%% A thin wrap around the put of a special tombstone object. There is no
|
||||
%% immediate reclaim of space, simply the addition of a more recent tombstone.
|
||||
|
@ -271,7 +286,11 @@ book_put(Pid, Bucket, Key, Object, IndexSpecs, Tag, TTL) ->
|
|||
book_delete(Pid, Bucket, Key, IndexSpecs) ->
|
||||
book_put(Pid, Bucket, Key, delete, IndexSpecs, ?STD_TAG).
|
||||
|
||||
%% @doc - GET and HAD requests
|
||||
|
||||
-spec book_get(pid(), any(), any(), atom()) -> {ok, any()}|not_found.
|
||||
-spec book_head(pid(), any(), any(), atom()) -> {ok, any()}|not_found.
|
||||
|
||||
%% @doc - GET and HEAD requests
|
||||
%%
|
||||
%% The Bookie supports both GET and HEAD requests, with the HEAD request
|
||||
%% returning only the metadata and not the actual object value. The HEAD
|
||||
|
@ -280,11 +299,6 @@ book_delete(Pid, Bucket, Key, IndexSpecs) ->
|
|||
%% GET requests first follow the path of a HEAD request, and if an object is
|
||||
%% found, then fetch the value from the Journal via the Inker.
|
||||
|
||||
book_get(Pid, Bucket, Key) ->
|
||||
book_get(Pid, Bucket, Key, ?STD_TAG).
|
||||
|
||||
book_head(Pid, Bucket, Key) ->
|
||||
book_head(Pid, Bucket, Key, ?STD_TAG).
|
||||
|
||||
book_get(Pid, Bucket, Key, Tag) ->
|
||||
gen_server:call(Pid, {get, Bucket, Key, Tag}, infinity).
|
||||
|
@ -292,6 +306,15 @@ book_get(Pid, Bucket, Key, Tag) ->
|
|||
book_head(Pid, Bucket, Key, Tag) ->
|
||||
gen_server:call(Pid, {head, Bucket, Key, Tag}, infinity).
|
||||
|
||||
book_get(Pid, Bucket, Key) ->
|
||||
book_get(Pid, Bucket, Key, ?STD_TAG).
|
||||
|
||||
book_head(Pid, Bucket, Key) ->
|
||||
book_head(Pid, Bucket, Key, ?STD_TAG).
|
||||
|
||||
|
||||
-spec book_returnfolder(pid(), tuple()) -> {async, fun()}.
|
||||
|
||||
%% @doc Snapshots/Clones
|
||||
%%
|
||||
%% If there is a snapshot request (e.g. to iterate over the keys) the Bookie
|
||||
|
@ -343,6 +366,12 @@ book_head(Pid, Bucket, Key, Tag) ->
|
|||
book_returnfolder(Pid, RunnerType) ->
|
||||
gen_server:call(Pid, {return_runner, RunnerType}, infinity).
|
||||
|
||||
|
||||
-spec book_snapshot(pid(),
|
||||
store|ledger,
|
||||
tuple()|undefined,
|
||||
boolean()|undefined) -> {ok, pid(), pid()|null}.
|
||||
|
||||
%% @doc create a snapshot of the store
|
||||
%%
|
||||
%% Snapshot can be based on a pre-defined query (which will be used to filter
|
||||
|
@ -353,6 +382,10 @@ book_returnfolder(Pid, RunnerType) ->
|
|||
book_snapshot(Pid, SnapType, Query, LongRunning) ->
|
||||
gen_server:call(Pid, {snapshot, SnapType, Query, LongRunning}, infinity).
|
||||
|
||||
|
||||
-spec book_compactjournal(pid(), integer()) -> ok.
|
||||
-spec book_islastcompactionpending(pid()) -> boolean().
|
||||
|
||||
%% @doc Call for compaction of the Journal
|
||||
%%
|
||||
%% the scheduling of Journla compaction is called externally, so it is assumed
|
||||
|
@ -366,6 +399,10 @@ book_compactjournal(Pid, Timeout) ->
|
|||
book_islastcompactionpending(Pid) ->
|
||||
gen_server:call(Pid, confirm_compact, infinity).
|
||||
|
||||
|
||||
-spec book_close(pid()) -> ok.
|
||||
-spec book_destroy(pid()) -> ok.
|
||||
|
||||
%% @doc Clean shutdown
|
||||
%%
|
||||
%% A clean shutdown will persist all the information in the Penciller memory
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
-module(leveled_sup).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% Supervisor callbacks
|
||||
-export([init/1]).
|
||||
|
||||
%% Helper macro for declaring children of supervisor
|
||||
-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
|
||||
|
||||
%% ===================================================================
|
||||
%% API functions
|
||||
%% ===================================================================
|
||||
|
||||
%% Currently this is just to keep dialyzer happy
|
||||
%% Run the store directly using leveled_bookie:book_start/4 or bookie_start/1
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, leveled_bookie}, ?MODULE, []).
|
||||
|
||||
%% ===================================================================
|
||||
%% Supervisor callbacks
|
||||
%% ===================================================================
|
||||
|
||||
init([]) ->
|
||||
{ok, { {one_for_one, 5, 10}, []} }.
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue