Interface BabelNetworkMessageSerializer<T extends BabelMessage>
- Type Parameters:
T- the concreteBabelMessagetype handled by this serializer
- All Superinterfaces:
BabelNetworkSerializer<T>
- All Known Implementing Classes:
BabelMessageSerializer, BasicSignedBabelMessageSerializer, FullSignedBabelMessageSerializer
public interface BabelNetworkMessageSerializer<T extends BabelMessage>
extends BabelNetworkSerializer<T>
Serializer contract for Babel IP network messages.
Extends BabelNetworkSerializer with a numeric identifier that is embedded in the
wire frame immediately after the Babel magic number. The receiving side reads this identifier
and looks up the matching deserializer in the
SerializerRegistry, allowing heterogeneous message types to share the same channel.
Concrete implementations are generated at compile time by the MessageProcessor
annotation processor for every record annotated with
BabelIPMessage. Each generated class is
registered as a service provider via @AutoService(BabelNetworkMessageSerializer.class).
-
Method Summary
Modifier and TypeMethodDescriptionintgetId()Returns the unique numeric identifier for the message type handled by this serializer.Methods inherited from interface BabelNetworkSerializer
deserialize, getEstimateSize, getEstimateSize, getObjectClass, serializeModifier and TypeMethodDescriptiondeserialize(io.netty.buffer.ByteBuf in, NodeStore store) Reads an instance ofTfrom the supplied buffer.default intgetEstimateSize(T object) Returns an estimated size in bytes for the given object.default intgetEstimateSize(T object, @Nullable NodeStore store) Returns a size estimate to fit the entire object in aByteBufwithout needing resizes.Returns the class of objects handled by this serializer, used for registry lookup.voidEncodesobjectand appends the resulting bytes toout.
-
Method Details
-
getId
int getId()Returns the unique numeric identifier for the message type handled by this serializer. The value corresponds to theidattribute of theBabelIPMessageannotation.- Returns:
- the message type identifier
-