Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: make synchronous transforms take a mutable receiver #480

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/saluki-components/src/transforms/chained/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Transform for Chained {

// We have to re-associate each subtransform with their allocation group token here, as we don't have access to
// it when the bounds are initially defined.
let subtransforms = self
let mut subtransforms = self
.subtransforms
.into_iter()
.map(|(subtransform_id, subtransform)| {
Expand All @@ -106,7 +106,7 @@ impl Transform for Chained {
_ = health.live() => continue,
maybe_events = context.event_stream().next() => match maybe_events {
Some(mut event_buffer) => {
for (allocation_token, transform) in &subtransforms {
for (allocation_token, transform) in &mut subtransforms {
let _guard = allocation_token.enter();
transform.transform_buffer(&mut event_buffer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl HostEnrichment {
}

impl SynchronousTransform for HostEnrichment {
fn transform_buffer(&self, event_buffer: &mut FixedSizeEventBuffer) {
fn transform_buffer(&mut self, event_buffer: &mut FixedSizeEventBuffer) {
for event in event_buffer {
if let Some(metric) = event.try_as_metric_mut() {
self.enrich_metric(metric)
Expand Down
2 changes: 1 addition & 1 deletion lib/saluki-core/src/components/transforms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ pub trait Transform {
/// within a single transform component for processing efficiency.
pub trait SynchronousTransform {
/// Transforms the events in the event buffer.
fn transform_buffer(&self, buffer: &mut FixedSizeEventBuffer);
fn transform_buffer(&mut self, buffer: &mut FixedSizeEventBuffer);
}
Loading