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
//! Provides structures and traits for handling account deletion events within
//! the pipeline.
//!
//! This module defines the `AccountDeletionPipe` struct and
//! `AccountDeletionPipes` trait, which allow for the processing of account
//! deletion events as they occur in the pipeline. By implementing
//! `AccountDeletionPipes`, you can create custom behavior for managing
//! the deletion of accounts and associated resources, integrating with metrics
//! for monitoring.
use ;
/// A processing pipe for handling account deletions.
///
/// The `AccountDeletionPipe` struct encapsulates the logic needed to process
/// account deletion events within the pipeline. It uses a `Processor` to define
/// how account deletions are managed, allowing for customizable handling based
/// on the needs of the application.
///
/// ## Functionality
///
/// This struct processes an `AccountDeletion` event by passing it through a
/// user-defined `Processor`. The processor is responsible for managing the
/// specific logic of the account deletion event, such as cleaning up resources
/// or updating other parts of the system. The `AccountDeletionPipe` also
/// integrates with `Metrics`, enabling the tracking and monitoring of deletion
/// events.
///
/// # Example
///
/// ```ignore
/// use carbon_core::error::CarbonResult;
/// use carbon_core::metrics::MetricsCollection;
/// use carbon_core::datasource::AccountDeletion;
/// use carbon_core::processor::Processor;
/// use async_trait::async_trait;
/// use std::sync::Arc;
///
/// struct MyAccountDeletionProcessor;
///
/// #[async_trait]
/// impl Processor for MyAccountDeletionProcessor {
/// async fn process(
/// &self,
/// account_deletion: AccountDeletion,
/// metrics: Arc<MetricsCollection>,
/// ) -> CarbonResult<()> {
/// // Custom deletion logic
/// Ok(())
/// }
/// }
/// ```
///
/// ## Fields
///
/// - `processor`: A boxed `Processor` that handles the specific logic of
/// processing an account deletion event.
/// - `filters`: A collection of filters that determine which account deletion
/// events should be processed. Each filter in this collection is applied to
/// incoming account deletion events, and only events that pass all filters
/// (return `true`) will be processed. If this collection is empty, all
/// events are processed.
///
/// # Notes
///
/// - Ensure that the `Processor` implementation provided is designed to handle
/// account deletions.
/// - This struct is typically used within the broader pipeline structure for
/// managing updates.
/// An async trait for processing account deletions.
///
/// The `AccountDeletionPipes` trait allows for processing of account deletions.
///
/// # Required Methods
///
/// - `run`: Processes an account deletion event and tracks the operation with
/// metrics.
/// - `filters`: Returns a reference to the filters associated with this pipe,
/// which are used by the pipeline to determine which account deletion events
/// should be processed.