Skip to content

Comments

MINOR: Simplify Header Serdes#21514

Merged
mjsax merged 5 commits intoapache:trunkfrom
mjsax:minor-simplify-header-serdes
Feb 20, 2026
Merged

MINOR: Simplify Header Serdes#21514
mjsax merged 5 commits intoapache:trunkfrom
mjsax:minor-simplify-header-serdes

Conversation

@mjsax
Copy link
Member

@mjsax mjsax commented Feb 19, 2026

HeadersSerializer and HeaderDeserializer are internal classes and there
is no reason why they would need to implement the public Serializer and
Deserializer interfaces. If we don't implement these interfaces, the
actual serialize() and deserialize() methods can be static simplifying
the code further.

Reviewers: Alieh Saeedi asaeedi@confluent.io, TengYao Chi
frankvicky@apache.org

HeadersSerialzier and HeaderDeserializer are internal classes and there is no reason why they would need to implement the public Serializer and Deserializer interfaces.
If we don't implement these interfaces, the actuall serialize() and deserialize() methods can be static simplifiying the code further.
@mjsax mjsax added the streams label Feb 19, 2026
@github-actions github-actions bot added the small Small PRs label Feb 19, 2026
final int headersSize = ByteUtils.readVarint(buffer);

final byte[] rawHeaders = readBytes(buffer, headersSize);
final Headers headers = headersDeserializer.deserialize(topic, rawHeaders);
Copy link
Contributor

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 topic that we dont need it at all.

Copy link
Contributor

@aliehsaeedii aliehsaeedii left a comment

Choose a reason for hiding this comment

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

Thanks @mjsax. The improvement makes sense to me.

@@ -52,20 +52,17 @@
public class ValueTimestampHeadersSerializer<V> implements WrappingNullableSerializer<ValueTimestampHeaders<V>, Void, V> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this class public while ValueTimestampHeadersDeserializer is package-private?

Copy link
Member Author

Choose a reason for hiding this comment

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

No idea -- but I think it can be package private. Actually same for HeadersSerializer and HeadersDeserializer. Let me make this change.

Copy link
Contributor

@frankvicky frankvicky left a comment

Choose a reason for hiding this comment

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

Thanks!
LGTM

@mjsax mjsax merged commit a48123e into apache:trunk Feb 20, 2026
23 checks passed
@mjsax mjsax deleted the minor-simplify-header-serdes branch February 20, 2026 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants