Skip to content

Commit 0166232

Browse files
committed
ref(server): Rename UnitOfWork to Input
1 parent 89efe07 commit 0166232

File tree

12 files changed

+56
-90
lines changed

12 files changed

+56
-90
lines changed

relay-server/src/processing/check_ins/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,11 @@ impl CheckInsProcessor {
5959
}
6060

6161
impl processing::Processor for CheckInsProcessor {
62-
type UnitOfWork = SerializedCheckIns;
62+
type Input = SerializedCheckIns;
6363
type Output = CheckInsOutput;
6464
type Error = Error;
6565

66-
fn prepare_envelope(
67-
&self,
68-
envelope: &mut ManagedEnvelope,
69-
) -> Option<Managed<Self::UnitOfWork>> {
66+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
7067
let headers = envelope.envelope().headers().clone();
7168

7269
let check_ins = envelope
@@ -80,7 +77,7 @@ impl processing::Processor for CheckInsProcessor {
8077

8178
async fn process(
8279
&self,
83-
mut check_ins: Managed<Self::UnitOfWork>,
80+
mut check_ins: Managed<Self::Input>,
8481
ctx: Context<'_>,
8582
) -> Result<Output<Self::Output>, Rejected<Self::Error>> {
8683
if ctx.is_processing() {

relay-server/src/processing/client_reports/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,11 @@ impl ClientReportsProcessor {
6464
}
6565

6666
impl processing::Processor for ClientReportsProcessor {
67-
type UnitOfWork = SerializedClientReports;
67+
type Input = SerializedClientReports;
6868
type Output = Nothing;
6969
type Error = Error;
7070

71-
fn prepare_envelope(
72-
&self,
73-
envelope: &mut ManagedEnvelope,
74-
) -> Option<Managed<Self::UnitOfWork>> {
71+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
7572
let headers = envelope.envelope().headers().clone();
7673
let reports = envelope
7774
.envelope_mut()
@@ -87,7 +84,7 @@ impl processing::Processor for ClientReportsProcessor {
8784

8885
async fn process(
8986
&self,
90-
reports: Managed<Self::UnitOfWork>,
87+
reports: Managed<Self::Input>,
9188
ctx: Context<'_>,
9289
) -> Result<Output<Self::Output>, Rejected<Self::Error>> {
9390
let mut outcomes = process::expand(reports);

relay-server/src/processing/errors/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,11 @@ impl ErrorsProcessor {
7272
}
7373

7474
impl processing::Processor for ErrorsProcessor {
75-
type UnitOfWork = SerializedError;
75+
type Input = SerializedError;
7676
type Output = ErrorOutput;
7777
type Error = Error;
7878

79-
fn prepare_envelope(
80-
&self,
81-
envelope: &mut ManagedEnvelope,
82-
) -> Option<Managed<Self::UnitOfWork>> {
79+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
8380
let has_transaction = envelope
8481
.envelope()
8582
.items()
@@ -107,7 +104,7 @@ impl processing::Processor for ErrorsProcessor {
107104

108105
async fn process(
109106
&self,
110-
error: Managed<Self::UnitOfWork>,
107+
error: Managed<Self::Input>,
111108
ctx: Context<'_>,
112109
) -> Result<Output<Self::Output>, Rejected<Self::Error>> {
113110
let mut error = process::expand(error, ctx)?;

relay-server/src/processing/logs/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,11 @@ impl LogsProcessor {
100100
}
101101

102102
impl processing::Processor for LogsProcessor {
103-
type UnitOfWork = SerializedLogs;
103+
type Input = SerializedLogs;
104104
type Output = LogOutput;
105105
type Error = Error;
106106

107-
fn prepare_envelope(
108-
&self,
109-
envelope: &mut ManagedEnvelope,
110-
) -> Option<Managed<Self::UnitOfWork>> {
107+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
111108
let headers = envelope.envelope().headers().clone();
112109

113110
let logs = envelope
@@ -135,7 +132,7 @@ impl processing::Processor for LogsProcessor {
135132

136133
async fn process(
137134
&self,
138-
logs: Managed<Self::UnitOfWork>,
135+
logs: Managed<Self::Input>,
139136
ctx: Context<'_>,
140137
) -> Result<Output<Self::Output>, Rejected<Error>> {
141138
validate::container(&logs).reject(&logs)?;

relay-server/src/processing/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,24 @@ pub mod utils;
4545
/// defines all items in an event based envelope to relate to the envelope.
4646
pub trait Processor {
4747
/// A unit of work, the processor can process.
48-
type UnitOfWork: Counted;
49-
/// The result after processing a [`Self::UnitOfWork`].
48+
type Input: Counted;
49+
/// The result after processing a [`Self::Input`].
5050
type Output: Forward;
5151
/// The error returned by [`Self::process`].
5252
type Error: std::error::Error + 'static;
5353

54-
/// Extracts a [`Self::UnitOfWork`] from a [`ManagedEnvelope`].
54+
/// Extracts a [`Self::Input`] from a [`ManagedEnvelope`].
5555
///
5656
/// This is infallible, if a processor wants to report an error,
5757
/// it should return a [`Self::UnitOfWork`] which later, can produce an error when being processed.
5858
///
5959
/// Returns `None` if nothing in the envelope concerns this processor.
60-
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope)
61-
-> Option<Managed<Self::UnitOfWork>>;
60+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>>;
6261

63-
/// Processes a [`Self::UnitOfWork`].
62+
/// Processes a [`Self::Input`].
6463
async fn process(
6564
&self,
66-
work: Managed<Self::UnitOfWork>,
65+
work: Managed<Self::Input>,
6766
ctx: Context<'_>,
6867
) -> Result<Output<Self::Output>, Rejected<Self::Error>>;
6968
}

relay-server/src/processing/profile_chunks/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,11 @@ impl ProfileChunksProcessor {
7272
}
7373

7474
impl processing::Processor for ProfileChunksProcessor {
75-
type UnitOfWork = SerializedProfileChunks;
75+
type Input = SerializedProfileChunks;
7676
type Output = ProfileChunkOutput;
7777
type Error = Error;
7878

79-
fn prepare_envelope(
80-
&self,
81-
envelope: &mut ManagedEnvelope,
82-
) -> Option<Managed<Self::UnitOfWork>> {
79+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
8380
let profile_chunks = envelope
8481
.envelope_mut()
8582
.take_items_by(|item| matches!(*item.ty(), ItemType::ProfileChunk))
@@ -100,7 +97,7 @@ impl processing::Processor for ProfileChunksProcessor {
10097

10198
async fn process(
10299
&self,
103-
mut profile_chunks: Managed<Self::UnitOfWork>,
100+
mut profile_chunks: Managed<Self::Input>,
104101
ctx: Context<'_>,
105102
) -> Result<Output<Self::Output>, Rejected<Error>> {
106103
filter::feature_flag(ctx).reject(&profile_chunks)?;

relay-server/src/processing/replays/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,11 @@ impl ReplaysProcessor {
156156
}
157157

158158
impl processing::Processor for ReplaysProcessor {
159-
type UnitOfWork = SerializedReplays;
159+
type Input = SerializedReplays;
160160
type Output = ReplaysOutput;
161161
type Error = Error;
162162

163-
fn prepare_envelope(
164-
&self,
165-
envelope: &mut ManagedEnvelope,
166-
) -> Option<Managed<Self::UnitOfWork>> {
163+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
167164
let headers = envelope.envelope().headers().clone();
168165
let events = envelope
169166
.envelope_mut()
@@ -194,7 +191,7 @@ impl processing::Processor for ReplaysProcessor {
194191

195192
async fn process(
196193
&self,
197-
replays: Managed<Self::UnitOfWork>,
194+
replays: Managed<Self::Input>,
198195
ctx: Context<'_>,
199196
) -> Result<Output<Self::Output>, Rejected<Self::Error>> {
200197
let replays = filter::feature_flag(replays, ctx)?;

relay-server/src/processing/sessions/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,11 @@ impl SessionsProcessor {
5656
}
5757

5858
impl processing::Processor for SessionsProcessor {
59-
type UnitOfWork = SerializedSessions;
59+
type Input = SerializedSessions;
6060
type Output = SessionsOutput;
6161
type Error = Error;
6262

63-
fn prepare_envelope(
64-
&self,
65-
envelope: &mut ManagedEnvelope,
66-
) -> Option<Managed<Self::UnitOfWork>> {
63+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
6764
let headers = envelope.envelope().headers().clone();
6865

6966
let updates = envelope
@@ -86,7 +83,7 @@ impl processing::Processor for SessionsProcessor {
8683

8784
async fn process(
8885
&self,
89-
sessions: Managed<Self::UnitOfWork>,
86+
sessions: Managed<Self::Input>,
9087
ctx: Context<'_>,
9188
) -> Result<Output<Self::Output>, Rejected<Self::Error>> {
9289
let mut sessions = match process::expand(sessions, ctx) {

relay-server/src/processing/spans/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,11 @@ impl SpansProcessor {
113113
}
114114

115115
impl processing::Processor for SpansProcessor {
116-
type UnitOfWork = SerializedSpans;
116+
type Input = SerializedSpans;
117117
type Output = SpanOutput;
118118
type Error = Error;
119119

120-
fn prepare_envelope(
121-
&self,
122-
envelope: &mut ManagedEnvelope,
123-
) -> Option<Managed<Self::UnitOfWork>> {
120+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
124121
let headers = envelope.envelope().headers().clone();
125122

126123
let spans = envelope
@@ -155,7 +152,7 @@ impl processing::Processor for SpansProcessor {
155152

156153
async fn process(
157154
&self,
158-
spans: Managed<Self::UnitOfWork>,
155+
spans: Managed<Self::Input>,
159156
ctx: Context<'_>,
160157
) -> Result<Output<Self::Output>, Rejected<Self::Error>> {
161158
let spans = filter::feature_flag_attachment(spans, ctx);

relay-server/src/processing/trace_attachments/mod.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,13 @@ impl TraceAttachmentsProcessor {
9292
}
9393

9494
impl Processor for TraceAttachmentsProcessor {
95-
type UnitOfWork = SerializedAttachments;
95+
type Input = SerializedAttachments;
9696

9797
type Output = Managed<ExpandedAttachments>;
9898

9999
type Error = Error;
100100

101-
fn prepare_envelope(
102-
&self,
103-
envelope: &mut ManagedEnvelope,
104-
) -> Option<Managed<Self::UnitOfWork>> {
101+
fn prepare_envelope(&self, envelope: &mut ManagedEnvelope) -> Option<Managed<Self::Input>> {
105102
let headers = envelope.envelope().headers().clone();
106103
let items = envelope
107104
.envelope_mut()
@@ -115,7 +112,7 @@ impl Processor for TraceAttachmentsProcessor {
115112

116113
async fn process(
117114
&self,
118-
work: Managed<Self::UnitOfWork>,
115+
work: Managed<Self::Input>,
119116
ctx: Context<'_>,
120117
) -> Result<Output<Self::Output>, Rejected<Self::Error>> {
121118
let work = filter::feature_flag(work, ctx)?;

0 commit comments

Comments
 (0)