1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
use crate::commands::job::cli::{
EmailAction, EmailArgs, JobCommands, JobType, RcloneAction, RcloneArgs,
};
use crate::commands::job::{deduplicate, email_import, rclone, transform};
use crate::core::observability::Observable as _;
pub fn dispatch(command: JobCommands) -> i32 {
match command {
JobCommands::Run(run_args) => {
let name = run_args.job_type.command_name();
let job_name = run_args.job_type.job_name();
crate::observability::run_instrumented(name, move || match run_args.job_type {
JobType::Email(EmailArgs { action }) => match action {
EmailAction::Import {
identities,
destination,
local_output,
messages_per_minute,
batch_size,
max_connections,
push_concurrency,
report_bucket,
non_interactive,
} => email_import::wizard::dispatch(
identities,
destination,
local_output,
messages_per_minute,
batch_size,
max_connections,
push_concurrency,
report_bucket,
job_name,
non_interactive,
),
},
JobType::Deduplicate {
source_bucket,
local_output,
destination_bucket,
concurrency,
transfers,
checkers,
tpslimit,
upload_only,
report_bucket,
non_interactive,
} => deduplicate::wizard::dispatch(
source_bucket,
local_output,
destination_bucket,
concurrency,
transfers,
checkers,
tpslimit,
upload_only,
report_bucket,
job_name,
non_interactive,
),
JobType::Rclone(RcloneArgs { action }) => match action {
RcloneAction::Copy {
source_bucket,
destination_bucket,
local_output,
report_bucket,
transfers,
checkers,
tpslimit,
non_interactive,
} => rclone::wizard::dispatch_copy(
source_bucket,
destination_bucket,
local_output,
report_bucket,
transfers,
checkers,
tpslimit,
job_name,
non_interactive,
),
RcloneAction::Delete {
source_bucket,
local_output,
report_bucket,
checkers,
non_interactive,
} => rclone::wizard::dispatch_delete(
source_bucket,
local_output,
report_bucket,
checkers,
job_name,
non_interactive,
),
},
JobType::Transform {
input_file_type,
video_quality,
source,
destination,
local_output,
concurrency,
download_transfers,
download_checkers,
upload_transfers,
max_pending_downloads,
tpslimit,
report_bucket,
non_interactive,
} => transform::wizard::dispatch(
input_file_type,
video_quality,
source,
destination,
local_output,
concurrency,
download_transfers,
download_checkers,
upload_transfers,
max_pending_downloads,
tpslimit,
report_bucket,
job_name,
non_interactive,
),
})
}
}
}