Package com.linkedin.venice.pubsub.api
Interface PubSubPosition
- All Superinterfaces:
Measurable
- All Known Implementing Classes:
ApacheKafkaOffsetPosition,InMemoryPubSubPosition
Represents a position of a message in a partition of a topic.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final InternalAvroSpecificSerializer<PubSubPositionWireFormat> -
Method Summary
Modifier and TypeMethodDescriptiondefault intCompares this position withotherusing only the information carried by the two positions, i.e.booleanClass<? extends PubSubPositionFactory>Returns the factory class responsible for creating this position type.default StringlongDeprecated.Position wrapper is used to wrap the position type and the position value.inthashCode()default booleandefault PubSubPositionJsonWireFormatdefault ByteBufferReturns the serialized wire format bytes of this position.default byte[]Serializes this position to a wire format and returns the result as a byte array.Methods inherited from interface com.linkedin.venice.memory.Measurable
getHeapSize
-
Field Details
-
PUBSUB_POSITION_WIRE_FORMAT_SERIALIZER
static final InternalAvroSpecificSerializer<PubSubPositionWireFormat> PUBSUB_POSITION_WIRE_FORMAT_SERIALIZER
-
-
Method Details
-
getNumericOffset
Deprecated. -
equals
-
hashCode
int hashCode() -
isSymbolic
default boolean isSymbolic() -
comparePositionOffline
Compares this position withotherusing only the information carried by the two positions, i.e. without a consumer, broker connection, or topic metadata. Both positions must belong to the same topic-partition.The default implementation orders positions by their numeric offsets when both are non-negative and otherwise throws. Implementations whose numeric offset is not meaningful (e.g. log-structured positions without a dense offset) should override this method when their wire format carries enough information to establish an order offline.
- Parameters:
other- the position to compare against; must not be null- Returns:
- a negative integer, zero, or a positive integer if this position is respectively before, equal to,
or after
other - Throws:
UnsupportedOperationException- if the two positions cannot be ordered without external state
-
getPositionWireFormat
PubSubPositionWireFormat getPositionWireFormat()Position wrapper is used to wrap the position type and the position value. This is used to serialize and deserialize the position object when sending and receiving it over the wire.- Returns:
- the position wrapper
-
toWireFormatBuffer
Returns the serialized wire format bytes of this position.- Returns:
- byte array representing the position in wire format
-
toWireFormatBytes
default byte[] toWireFormatBytes()Serializes this position to a wire format and returns the result as a byte array. This method bypasses ByteBuffer and directly returns the backing array.- Returns:
- a byte array representing the serialized wire format of this position
-
toJsonWireFormat
-
getFactoryClass
Class<? extends PubSubPositionFactory> getFactoryClass()Returns the factory class responsible for creating this position type. This enables strong type checking and reflection-based instantiation without requiring the actual factory instance to be returned.- Returns:
- the class object of the factory that can construct this position
-
getFactoryClassName
-