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
//! Database update action types.
use Deserialize;
/// The type of pending database update operation.
///
/// Used to track what action should be performed when flushing pending
/// updates to the database. Updates are batched for efficiency and then
/// processed based on their action type.
///
/// # Variants
///
/// - **Add**: Insert a new record (e.g., new torrent, new user)
/// - **Remove**: Delete an existing record
/// - **Update**: Modify an existing record
///
/// # Batching Strategy
///
/// The tracker batches database operations for efficiency:
/// 1. Changes are recorded in memory with their action type
/// 2. Periodically, all pending updates are flushed to the database
/// 3. The action type determines the SQL operation (INSERT, DELETE, UPDATE)
///
/// # Example
///
/// ```rust
/// use torrust_actix::tracker::enums::updates_action::UpdatesAction;
///
/// let action = UpdatesAction::Add;
/// match action {
/// UpdatesAction::Add => { /* INSERT */ }
/// UpdatesAction::Update => { /* UPDATE */ }
/// UpdatesAction::Remove => { /* DELETE */ }
/// }
/// ```