1 |
|
%% Just a proxy interface module between the main mod_http_upload module and |
2 |
|
%% the backend modules (i.e. mod_http_upload_s3). |
3 |
|
-module(mod_http_upload_backend). |
4 |
|
|
5 |
|
-export([init/2, create_slot/7]). |
6 |
|
|
7 |
|
-define(MAIN_MODULE, mod_http_upload). |
8 |
|
%%-------------------------------------------------------------------- |
9 |
|
%% Callbacks |
10 |
|
%%-------------------------------------------------------------------- |
11 |
|
|
12 |
|
-callback create_slot(UTCDateTime :: calendar:datetime(), UUID :: binary(), |
13 |
|
Filename :: unicode:unicode_binary(), ContentType :: binary() | undefined, |
14 |
|
Size :: pos_integer(), gen_mod:module_opts()) -> |
15 |
|
{PUTURL :: binary(), GETURL :: binary(), Headers :: #{binary() => binary()}}. |
16 |
|
|
17 |
|
-spec init(HostType :: mongooseim:host_type(), Opts :: gen_mod:module_opts()) -> ok. |
18 |
|
init(HostType, Opts) -> |
19 |
6 |
mongoose_backend:init(HostType, ?MAIN_MODULE, [create_slot], Opts). |
20 |
|
|
21 |
|
-spec create_slot(HostType::mongooseim:host_type(), |
22 |
|
UTCDateTime :: calendar:datetime(), |
23 |
|
UUID :: binary(), |
24 |
|
Filename :: unicode:unicode_binary(), |
25 |
|
ContentType :: binary() | undefined, |
26 |
|
Size :: pos_integer(), |
27 |
|
Opts :: gen_mod:module_opts()) -> |
28 |
|
{PUTURL :: binary(), GETURL :: binary(), Headers :: #{binary() => binary()}}. |
29 |
|
create_slot(HostType, UTCDateTime, UUID, Filename, ContentType, Size, Opts) -> |
30 |
21 |
Args = [UTCDateTime, UUID, Filename, ContentType, Size, Opts], |
31 |
21 |
mongoose_backend:call_tracked(HostType, ?MAIN_MODULE, ?FUNCTION_NAME, Args). |