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

transform-sdk/rust: introduce RecordWriter #15923

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

rockwotj
Copy link
Contributor

@rockwotj rockwotj commented Jan 3, 2024

In a similar change to our Golang SDK (#15922), also have a non-buffering record writer to output transformed records to.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x
  • v23.1.x

Release Notes

Improvements

  • Data Transforms written in Rust now use a non-buffered write mechanism. Transforms that used to be written as

    fn my_transform(event: WriteEvent) -> Result<Vec<Record>> {
      Ok(vec![
        Record::new(
          event.record.key().map(|k| k.to_owned()),
          event.record.value().map(|v| v.to_owned()),
        )
      ])
    }
    

    Can now be written as

    fn my_transform(event: WriteEvent, writer: &mut dyn RecordWriter) -> Result<()> {
      writer.write(Record::new(
        event.record.key().map(|k| k.to_owned()),
        event.record.value().map(|v| v.to_owned()),
      ))?;
      Ok(())
    }
    

@github-actions github-actions bot added the area/wasm WASM Data Transforms label Jan 3, 2024
@rockwotj rockwotj self-assigned this Jan 3, 2024
@rockwotj rockwotj force-pushed the record-writer-rust branch 3 times, most recently from d6526f3 to 666b9a2 Compare January 3, 2024 15:14
@rockwotj
Copy link
Contributor Author

rockwotj commented Jan 3, 2024

Force pushes: Update the public WriteError type to a better error type idiom.

@rockwotj rockwotj added this to the v23.3.x-next milestone Jan 3, 2024
In a similar change to our golang SDK, also have a non-buffering record
writer to output transformed records to.

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Copy link
Member

@oleiman oleiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust really is quite nice 👌

@rockwotj rockwotj merged commit 2e1bc9d into redpanda-data:dev Jan 3, 2024
25 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rpk area/wasm WASM Data Transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants