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

chore: wrap offset_flush return in pin<box<_>> #4306

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

fraidev
Copy link
Contributor

@fraidev fraidev commented Dec 29, 2024

I need that changes to be able to store dynamic ConsumerStream in a struct for infinyon/fluvio-client-python#541

Remembering that we can't use generics with pyo3 structures.

@fraidev fraidev changed the title wip ConsumerStream Pin<Box>> Dec 29, 2024
@fraidev fraidev force-pushed the consumer_pin branch 2 times, most recently from 1d46dad to bb45f6f Compare December 29, 2024 04:21
@fraidev fraidev requested review from digikata and sehz December 30, 2024 19:44
@fraidev fraidev marked this pull request as ready for review December 30, 2024 19:44
@fraidev fraidev changed the title ConsumerStream Pin<Box>> Refactor offset_flush Method to Use Pin Box in Consumer Stream Implementations Dec 30, 2024
@fraidev fraidev changed the title Refactor offset_flush Method to Use Pin Box in Consumer Stream Implementations chore: wrap offset_flush return in pin<box<_>> Dec 30, 2024
@@ -19,7 +20,7 @@ pub trait ConsumerStream: Stream<Item = Result<Record, ErrorCode>> + Unpin {
fn offset_commit(&mut self) -> Result<(), ErrorCode>;

/// Send the committed offset to the server. The method waits for the server's acknowledgment before it finishes.
fn offset_flush(&mut self) -> impl Future<Output = Result<(), ErrorCode>> + Send;
fn offset_flush(&mut self) -> Pin<Box<dyn Future<Output = Result<(), ErrorCode>> + Send + '_>>;
Copy link
Contributor

@sehz sehz Dec 30, 2024

Choose a reason for hiding this comment

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

can you try to alias this type so can reuse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure! what do you think:

type OffsetFlushFuture<'a> = Pin<Box<dyn Future<Output = Result<(), ErrorCode>> + Send + 'a>>;

@fraidev fraidev added this pull request to the merge queue Dec 30, 2024
Merged via the queue into infinyon:master with commit 0680e60 Dec 30, 2024
107 checks passed
@fraidev fraidev deleted the consumer_pin branch December 30, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants