-
Notifications
You must be signed in to change notification settings - Fork 15k
MINOR: Simplify Header Serdes #21514
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
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,20 +52,17 @@ | |
| public class ValueTimestampHeadersSerializer<V> implements WrappingNullableSerializer<ValueTimestampHeaders<V>, Void, V> { | ||
|
||
| public final Serializer<V> valueSerializer; | ||
| private final LongSerializer timestampSerializer; | ||
| private final HeadersSerializer headersSerializer; | ||
|
|
||
| ValueTimestampHeadersSerializer(final Serializer<V> valueSerializer) { | ||
| Objects.requireNonNull(valueSerializer); | ||
| this.valueSerializer = valueSerializer; | ||
| this.timestampSerializer = new LongSerializer(); | ||
| this.headersSerializer = new HeadersSerializer(); | ||
| } | ||
|
|
||
| @Override | ||
| public void configure(final Map<String, ?> configs, final boolean isKey) { | ||
| valueSerializer.configure(configs, isKey); | ||
| timestampSerializer.configure(configs, isKey); | ||
| headersSerializer.configure(configs, isKey); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -95,7 +92,7 @@ private byte[] serialize(final String topic, final V plainValue, final long time | |
| final byte[] rawTimestamp = timestampSerializer.serialize(topic, timestamp); | ||
|
|
||
| // empty (byte[0]) for null/empty headers, or [count][header1][header2]... for non-empty | ||
| final byte[] rawHeaders = headersSerializer.serialize(topic, headers); | ||
| final byte[] rawHeaders = HeadersSerializer.serialize(headers); | ||
|
|
||
| // Format: [headersSize(varint)][headersBytes][timestamp(8)][value] | ||
| try (final ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
|
|
@@ -116,7 +113,6 @@ private byte[] serialize(final String topic, final V plainValue, final long time | |
| public void close() { | ||
| valueSerializer.close(); | ||
| timestampSerializer.close(); | ||
| headersSerializer.close(); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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.
Makes sense to me. Reviewing other PRs, I was all the time thinking about the
topicthat we dont need it at all.