fix(ft): fix typings
This commit is contained in:
parent
2f1970adbc
commit
f6461fe287
|
@ -44,6 +44,7 @@
|
|||
transfer := emqx_ft:transfer(),
|
||||
name := file:name(),
|
||||
size := _Bytes :: non_neg_integer(),
|
||||
timestamp := emqx_datetime:epoch_second(),
|
||||
uri => uri_string:uri_string(),
|
||||
meta => emqx_ft:filemeta()
|
||||
}.
|
||||
|
|
|
@ -45,15 +45,7 @@
|
|||
-type options() :: _TODO.
|
||||
-type transfer() :: emqx_ft:transfer().
|
||||
-type filemeta() :: emqx_ft:filemeta().
|
||||
-type exportinfo() :: #{
|
||||
transfer := transfer(),
|
||||
name := file:name(),
|
||||
uri := uri_string:uri_string(),
|
||||
timestamp := emqx_datetime:epoch_second(),
|
||||
size := _Bytes :: non_neg_integer(),
|
||||
meta => filemeta()
|
||||
}.
|
||||
|
||||
-type exportinfo() :: emqx_ft_storage:file_info().
|
||||
-type file_error() :: emqx_ft_storage_fs:file_error().
|
||||
|
||||
-type export_st() :: #{
|
||||
|
|
|
@ -32,19 +32,20 @@
|
|||
]).
|
||||
|
||||
-type headers() :: #{binary() | string() => iodata()}.
|
||||
-type erlcloud_headers() :: list({string(), iodata()}).
|
||||
|
||||
-type key() :: string().
|
||||
-type part_number() :: non_neg_integer().
|
||||
-type upload_id() :: string().
|
||||
-type etag() :: string().
|
||||
|
||||
-type upload_options() :: list({acl, emqx_s3:acl()}).
|
||||
|
||||
-opaque client() :: #{
|
||||
aws_config := aws_config(),
|
||||
options := upload_options(),
|
||||
upload_options := upload_options(),
|
||||
bucket := string(),
|
||||
headers := headers()
|
||||
headers := erlcloud_headers(),
|
||||
url_expire_time := non_neg_integer()
|
||||
}.
|
||||
|
||||
-type config() :: #{
|
||||
|
@ -62,7 +63,7 @@
|
|||
max_retries := non_neg_integer() | undefined
|
||||
}.
|
||||
|
||||
-type s3_options() :: list({string(), string()}).
|
||||
-type s3_options() :: proplists:proplist().
|
||||
|
||||
-define(DEFAULT_REQUEST_TIMEOUT, 30000).
|
||||
-define(DEFAULT_MAX_RETRIES, 2).
|
||||
|
@ -171,10 +172,10 @@ abort_multipart(#{bucket := Bucket, headers := Headers, aws_config := AwsConfig}
|
|||
{error, Reason}
|
||||
end.
|
||||
|
||||
-spec list(client(), s3_options()) -> ok_or_error(term()).
|
||||
-spec list(client(), s3_options()) -> ok_or_error(proplists:proplist(), term()).
|
||||
list(#{bucket := Bucket, aws_config := AwsConfig}, Options) ->
|
||||
try
|
||||
{ok, erlcloud_s3:list_objects(Bucket, Options, AwsConfig)}
|
||||
try erlcloud_s3:list_objects(Bucket, Options, AwsConfig) of
|
||||
Result -> {ok, Result}
|
||||
catch
|
||||
error:{aws_error, Reason} ->
|
||||
?SLOG(debug, #{msg => "list_objects_fail", bucket => Bucket, reason => Reason}),
|
||||
|
|
|
@ -20,12 +20,13 @@ create_table() ->
|
|||
set
|
||||
]).
|
||||
|
||||
-spec register(ets:tid(), pid(), reference(), emqx_s3_profile_http_pools:pool_name()) -> true.
|
||||
-spec register(ets:tid(), pid(), reference(), emqx_s3_profile_http_pools:pool_name()) -> ok.
|
||||
register(Tab, Pid, MRef, PoolName) ->
|
||||
true = ets:insert(Tab, {Pid, {MRef, PoolName}}),
|
||||
ok.
|
||||
|
||||
-spec unregister(ets:tid(), pid()) -> emqx_s3_profile_http_pools:pool_name() | undefined.
|
||||
-spec unregister(ets:tid(), pid()) ->
|
||||
{reference(), emqx_s3_profile_http_pools:pool_name()} | undefined.
|
||||
unregister(Tab, Pid) ->
|
||||
case ets:take(Tab, Pid) of
|
||||
[{Pid, {MRef, PoolName}}] ->
|
||||
|
|
|
@ -89,7 +89,8 @@ unregister_client(ProfileId, PoolName) ->
|
|||
set_outdated(ProfileId, PoolName, Timeout) ->
|
||||
Key = key(ProfileId, PoolName),
|
||||
Now = erlang:monotonic_time(millisecond),
|
||||
ets:update_element(?TAB, Key, {#pool.deadline, Now + Timeout}).
|
||||
_ = ets:update_element(?TAB, Key, {#pool.deadline, Now + Timeout}),
|
||||
ok.
|
||||
|
||||
-spec outdated(emqx_s3:profile_id()) ->
|
||||
[pool_name()].
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
max_part_size := pos_integer(),
|
||||
upload_id := undefined | emqx_s3_client:upload_id(),
|
||||
etags := [emqx_s3_client:etag()],
|
||||
part_number := emqx_s3_client:part_number()
|
||||
part_number := emqx_s3_client:part_number(),
|
||||
headers := emqx_s3_client:headers()
|
||||
}.
|
||||
|
||||
%% 5MB
|
||||
|
@ -252,7 +253,7 @@ upload_part(
|
|||
Error
|
||||
end.
|
||||
|
||||
-spec complete_upload(data()) -> ok_or_error(term()).
|
||||
-spec complete_upload(data()) -> ok_or_error(data(), term()).
|
||||
complete_upload(
|
||||
#{
|
||||
client := Client,
|
||||
|
|
Loading…
Reference in New Issue