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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
//! Job execution results and status types.
//!
//! This module provides types for representing the various outcomes of job execution.
//! Jobs can complete successfully, be cancelled, or be snoozed for later execution.
//!
//! # Examples
//!
//! ```rust
//! use ishikari::{Complete, Cancel, Snooze, Status};
//!
//! // Complete a job with a success message
//! let status = Complete::default()
//! .message("Job processed successfully");
//!
//! // Cancel a job with a reason
//! let status = Cancel::default()
//! .message("Job cancelled due to invalid data");
//!
//! // Snooze a job for 5 minutes
//! let status = Snooze(300);
//! ```
/// Represents a successfully completed job.
///
/// This type is used to indicate that a job has completed its execution successfully.
/// It can optionally include a message describing the completion.
///
/// # Examples
///
/// ```rust
/// use ishikari::Complete;
///
/// // Complete without a message
/// let complete = Complete::default();
///
/// // Complete with a message
/// let complete = Complete::default()
/// .message("Successfully processed 100 records");
/// ```
;
/// Represents a cancelled job.
///
/// This type is used to indicate that a job has been cancelled before completion.
/// It can optionally include a message explaining why the job was cancelled.
///
/// # Examples
///
/// ```rust
/// use ishikari::Cancel;
///
/// // Cancel without a reason
/// let cancel = Cancel::default();
///
/// // Cancel with a reason
/// let cancel = Cancel::default()
/// .message("Cancelled due to invalid input data");
/// ```
;
/// Represents a job that should be executed later.
///
/// This type is used to indicate that a job should be rescheduled for later execution.
/// The contained value represents the number of seconds to wait before retrying.
///
/// # Examples
///
/// ```rust
/// use ishikari::Snooze;
///
/// // Snooze for 5 minutes
/// let snooze = Snooze(300);
///
/// // Snooze for 1 hour
/// let snooze = Snooze(3600);
/// ```
;
/// Represents the final status of a job execution.
///
/// This enum encapsulates all possible outcomes of a job execution:
/// - `Complete`: The job finished successfully
/// - `Cancel`: The job was cancelled
/// - `Snooze`: The job should be retried later
///
/// # Examples
///
/// ```rust
/// use ishikari::{Status, Complete, Cancel, Snooze};
///
/// // Complete a job
/// let status = Status::Complete(Complete::default());
///
/// // Cancel a job
/// let status = Status::Cancel(Cancel::default());
///
/// // Snooze a job
/// let status = Status::Snooze(Snooze(300));
/// ```
/// The error type returned by job execution.
///
/// This is a boxed error that can be sent between threads and shared safely.
/// It's recommended to use `anyhow::Error` for job errors as it implements
/// the required traits automatically.
pub type PerformError = ;
/// The result type returned by job execution.
///
/// This type represents either a successful job status or an error that occurred
/// during execution.
pub type PerformResult = Result;