From e311fd770869478f19d591e4229b09f61934f4f4 Mon Sep 17 00:00:00 2001 From: Kostis Sagonas Date: Wed, 19 Oct 2016 12:29:20 +0200 Subject: Declare types and specs --- lib/inets/src/ftp/ftp_progress.erl | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'lib/inets/src/ftp/ftp_progress.erl') diff --git a/lib/inets/src/ftp/ftp_progress.erl b/lib/inets/src/ftp/ftp_progress.erl index 68185a222d..a6263e5cd7 100644 --- a/lib/inets/src/ftp/ftp_progress.erl +++ b/lib/inets/src/ftp/ftp_progress.erl @@ -36,11 +36,11 @@ -include_lib("kernel/include/file.hrl"). -record(progress, { - file, % string() - cb_module, % atom() - cb_function, % atom() - init_progress_term, % term() - current_progress_term % term() + file :: string() | 'undefined', + cb_module :: module(), + cb_function :: atom(), + init_progress_term :: term(), + current_progress_term :: term() }). %%%========================================================================= @@ -53,13 +53,15 @@ %% Description: Starts the progress report process unless progress reporting %% should not be performed. %%-------------------------------------------------------------------------- +-type options() :: 'ignore' | {module(), atom(), term()}. +-spec start_link(options()) -> 'ignore' | pid(). start_link(ignore) -> ignore; start_link(Options) -> spawn_link(?MODULE, init, [Options]). %%-------------------------------------------------------------------------- -%% report_progress(Pid, Report) -> _ +%% report_progress(Pid, Report) -> ok %% Pid = pid() %% Report = {local_file, File} | {remote_file, File} | %% {transfer_size, Size} @@ -68,17 +70,23 @@ start_link(Options) -> %% Description: Reports progress to the reporting process that calls the %% user defined callback function. %%-------------------------------------------------------------------------- +-type report() :: {'local_file', string()} | {'remote_file', string()} + | {'transfer_size', non_neg_integer()}. +-spec report(pid(), report()) -> 'ok'. report(Pid, Report) -> - Pid ! {progress_report, Report}. + Pid ! {progress_report, Report}, + ok. %%-------------------------------------------------------------------------- -%% stop(Pid) -> _ +%% stop(Pid) -> ok %% Pid = pid() %% %% Description: %%-------------------------------------------------------------------------- +-spec stop(pid()) -> 'ok'. stop(Pid) -> - Pid ! stop. + Pid ! stop, + ok. %%%========================================================================= %%% Internal functions -- cgit v1.2.3