Data type cleanups, other
This commit is contained in:
parent
edce9d6463
commit
028ddc79ff
5 changed files with 18 additions and 18 deletions
|
@ -65,25 +65,25 @@ dump() ->
|
|||
[Y,M,D,HH,MM,SS])),
|
||||
cluster_info:dump_local_node(Filename).
|
||||
|
||||
-spec public_projection(atom()) -> ok.
|
||||
-spec public_projection(atom()) -> [{atom(), term()}].
|
||||
public_projection(FluName) ->
|
||||
projection(FluName, public).
|
||||
|
||||
-spec private_projection(atom()) -> ok.
|
||||
-spec private_projection(atom()) -> [{atom(), term()}].
|
||||
private_projection(FluName) ->
|
||||
projection(FluName, private).
|
||||
|
||||
-spec chain_manager(atom()) -> ok.
|
||||
-spec chain_manager(atom()) -> term().
|
||||
chain_manager(FluName) ->
|
||||
Mgr = machi_flu_psup:make_mgr_supname(FluName),
|
||||
sys:get_status(Mgr).
|
||||
|
||||
-spec fitness(atom()) -> ok.
|
||||
-spec fitness(atom()) -> term().
|
||||
fitness(FluName) ->
|
||||
Fitness = machi_flu_psup:make_fitness_regname(FluName),
|
||||
sys:get_status(Fitness).
|
||||
|
||||
-spec flu1(atom()) -> ok.
|
||||
-spec flu1(atom()) -> [{atom(), term()}].
|
||||
flu1(FluName) ->
|
||||
State = machi_flu1:current_state(FluName),
|
||||
machi_flu1:format_state(State).
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
-endif.
|
||||
|
||||
-record(machi_csum_table,
|
||||
{file :: filename:filename(),
|
||||
fd :: file:descriptor(),
|
||||
{file :: string(),
|
||||
fd :: file:io_device(),
|
||||
table :: ets:tid()}).
|
||||
|
||||
-type table() :: #machi_csum_table{}.
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
-export_type([table/0]).
|
||||
|
||||
-spec open(filename:filename(), proplists:proplists()) ->
|
||||
-spec open(string(), proplists:proplist()) ->
|
||||
{ok, table()} | {error, file:posix()}.
|
||||
open(CSumFilename, _Opts) ->
|
||||
T = ets:new(?MODULE, [private, ordered_set]),
|
||||
|
@ -62,10 +62,10 @@ open(CSumFilename, _Opts) ->
|
|||
{ok, Fd} = file:open(CSumFilename, [raw, binary, append]),
|
||||
{ok, C0#machi_csum_table{fd=Fd}}.
|
||||
|
||||
-spec find(table(), machi_dt:chunk_pos(), machi_dt:chunk_size()) ->
|
||||
-spec find(table(), machi_dt:file_offset(), machi_dt:file_size()) ->
|
||||
list({machi_dt:chunk_pos(),
|
||||
machi_dt:chunk_size(),
|
||||
machi_dt:csum()}).
|
||||
machi_dt:chunk_csum()}).
|
||||
find(#machi_csum_table{table=T}, Offset, Size) ->
|
||||
ets:select(T, [{{'$1', '$2', '$3'},
|
||||
[inclusion_match_spec(Offset, Size)],
|
||||
|
@ -76,7 +76,7 @@ all(#machi_csum_table{table=T}) ->
|
|||
ets:tab2list(T).
|
||||
-endif.
|
||||
|
||||
-spec write(table(), machi_dt:chunk_pos(), machi_dt:chunk_size(),
|
||||
-spec write(table(), machi_dt:file_offset(), machi_dt:file_size(),
|
||||
machi_dt:chunk_csum()) ->
|
||||
ok | {error, used|file:posix()}.
|
||||
write(#machi_csum_table{fd=Fd, table=T}, Offset, Size, CSum) ->
|
||||
|
@ -93,7 +93,7 @@ write(#machi_csum_table{fd=Fd, table=T}, Offset, Size, CSum) ->
|
|||
Error
|
||||
end.
|
||||
|
||||
-spec trim(table(), machi_dt:chunk_pos(), machi_dt:chunk_size()) ->
|
||||
-spec trim(table(), machi_dt:file_offset(), machi_dt:file_size()) ->
|
||||
ok | {error, file:posix()}.
|
||||
trim(#machi_csum_table{fd=Fd, table=T}, Offset, Size) ->
|
||||
Binary = encode_csum_file_entry_bin(Offset, Size, trimmed),
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
-type chunk_bin() :: binary() | iolist(). % client can use either
|
||||
-type chunk_csum() :: binary(). % 1 byte tag, N-1 bytes checksum
|
||||
-type chunk_summary() :: {file_offset(), chunk_size(), binary()}.
|
||||
-type chunk_s() :: binary(). % server always uses binary()
|
||||
-type chunk_s() :: 'trimmed' | binary().
|
||||
-type chunk_pos() :: {file_offset(), chunk_size(), file_name_s()}.
|
||||
-type chunk_size() :: non_neg_integer().
|
||||
-type error_general() :: 'bad_arg' | 'wedged' | 'bad_checksum'.
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
csum_file :: string()|undefined,
|
||||
csum_path :: string()|undefined,
|
||||
eof_position = 0 :: non_neg_integer(),
|
||||
data_filehandle :: file:filehandle(),
|
||||
data_filehandle :: file:io_device(),
|
||||
csum_table :: machi_csum_table:table(),
|
||||
tref :: reference(), %% timer ref
|
||||
ticks = 0 :: non_neg_integer(), %% ticks elapsed with no new operations
|
||||
|
@ -498,7 +498,7 @@ check_or_make_tagged_csum(OtherTag, _ClientCsum, _Data) ->
|
|||
lager:warning("Unknown checksum tag ~p", [OtherTag]),
|
||||
{error, bad_checksum}.
|
||||
|
||||
-spec do_read(FHd :: file:filehandle(),
|
||||
-spec do_read(FHd :: file:io_device(),
|
||||
Filename :: string(),
|
||||
CsumTable :: machi_csum_table:table(),
|
||||
Offset :: non_neg_integer(),
|
||||
|
@ -560,7 +560,7 @@ read_all_ranges(FHd, Filename, [{Offset, Size, TaggedCsum}|T], ReadChunks) ->
|
|||
{error, Other}
|
||||
end.
|
||||
|
||||
-spec handle_write( FHd :: file:filehandle(),
|
||||
-spec handle_write( FHd :: file:io_device(),
|
||||
CsumTable :: machi_csum_table:table(),
|
||||
Filename :: string(),
|
||||
TaggedCsum :: binary(),
|
||||
|
@ -618,7 +618,7 @@ handle_write(FHd, CsumTable, Filename, TaggedCsum, Offset, Data) ->
|
|||
|
||||
% @private Implements the disk writes for both the write and append
|
||||
% operation.
|
||||
-spec do_write( FHd :: file:descriptor(),
|
||||
-spec do_write( FHd :: file:io_device(),
|
||||
CsumTable :: machi_csum_table:table(),
|
||||
Filename :: string(),
|
||||
TaggedCsum :: binary(),
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
-record(state, {fluname :: atom(),
|
||||
tid :: ets:tid(),
|
||||
datadir :: file:dir(),
|
||||
datadir :: string(),
|
||||
epoch :: pv1_epoch_n()
|
||||
}).
|
||||
|
||||
|
|
Loading…
Reference in a new issue