-
Notifications
You must be signed in to change notification settings - Fork 489
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
Update producer and consumer to allow sending and receiving Key/Value records #828
Update producer and consumer to allow sending and receiving Key/Value records #828
Conversation
@nicholastmosher, is there a sample CLI on how to use this feature? We need to prepare a simple app or blog to introduce it. |
Hmmm... this looks very complicated to me and it shouldn't be. |
For CLI, here is one way to do:
|
We should simplify API much as possible.
For case, where only values is send:
|
I suggest keeping the .send() for values and have an alternative API for send KV. That way the most common use case |
K/V will be more typical use case rather than other way around. |
In that case, send it is... |
There should be some indication this is a key/value record, I assume is `--key-separator
|
|
88c10c2
to
ac530ac
Compare
fc0b056
to
deee844
Compare
846833a
to
1df9a3a
Compare
@simlay Can you review this as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sehyo managed to cover most of my concerns about things. I had some minor nits.
Also what's the file src/dataplane-protocol/tests/test_old_record_empty_key.bin
?
@simlay that Basically, I used the old encoder to encode a specific record into bytes, and saved those bytes into |
bc3cdae
to
1dbc25f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm good with this.
Can you squash commits and produce clean commit logs? |
Remove value-only constructors for Record Fix doc tests and remove unused imports Save K/V without Option in protocol Use Option for key in protocol Write test for decoding old record as new record Apply cargo clippy Rename send_key_value_records to send Bump fluvio client version to 0.6.0 Create example for key-value producer Add key-value example to Fluvio client docs Fix example tests Bump up consumer test-runner timeout Review: Add constructors for DefaultRecord Add back From<String> for Record<B> Review: Fix extra ref in example Add back AsRef<[u8]> for Record Add key() and value() methods to DefaultRecord Add back value-only constructors for dataplane Record Add into_inner() for consumer Record
1dbc25f
to
0166396
Compare
Here's a list of changes in this PR:
Record::key(&self) -> &[u8]
andRecord::value(&self) -> &[u8]
in the consumerimpl AsRef<[u8]> for Record
in consumer because we now want to explicitly distinguish between keys and valuesTopicProducer::send_key_value_record(&self, key: K, value: V, partition: i32)
to producerkey: B
tokey: Option<B>
(where B is a byte buffer)0x00
.Option::None
Option::None
tag is encoded as0x00
(as opposed toOption::Some
, whose tag is0x01
)Some potentially-open-questions:
Record::key
Record::value
TopicProducer::send_key_value_record
TopicProducer::send