Class ApacheKafkaOffsetPosition
java.lang.Object
com.linkedin.venice.pubsub.adapter.kafka.common.ApacheKafkaOffsetPosition
- All Implemented Interfaces:
Measurable
,PubSubPosition
Offset position for Apache Kafka topics
-
Field Summary
Fields inherited from interface com.linkedin.venice.pubsub.api.PubSubPosition
PUBSUB_POSITION_WIRE_FORMAT_SERIALIZER
-
Constructor Summary
ConstructorsConstructorDescriptionApacheKafkaOffsetPosition
(long offset) ApacheKafkaOffsetPosition
(ByteBuffer buffer) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Class<? extends PubSubPositionFactory>
Returns the factory class responsible for creating this position type.int
long
long
Returns an Avro-encoded wire format representation of this position, including both the position type ID and the raw Avro-encoded bytes representing the position value.int
hashCode()
static ApacheKafkaOffsetPosition
of
(long offset) static ApacheKafkaOffsetPosition
of
(ByteBuffer buffer) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linkedin.venice.pubsub.api.PubSubPosition
getFactoryClassName, isSymbolic, toWireFormatBuffer, toWireFormatBytes
-
Constructor Details
-
ApacheKafkaOffsetPosition
public ApacheKafkaOffsetPosition(long offset) -
ApacheKafkaOffsetPosition
- Parameters:
buffer
- the buffer to read from. The ByteBuffer expected to contain avro serialized long- Throws:
IOException
- if the buffer is not a valid avro serialized long
-
-
Method Details
-
getInternalOffset
public long getInternalOffset() -
toString
-
equals
- Specified by:
equals
in interfacePubSubPosition
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfacePubSubPosition
- Overrides:
hashCode
in classObject
-
getNumericOffset
public long getNumericOffset()- Specified by:
getNumericOffset
in interfacePubSubPosition
-
of
-
of
- Throws:
IOException
-
getPositionWireFormat
Returns an Avro-encoded wire format representation of this position, including both the position type ID and the raw Avro-encoded bytes representing the position value. This is used to transmitPubSubPosition
instances over the wire.Example (ApacheKafkaOffsetPosition):
+-------------------------+ | Avro-encoded int: type | (e.g., 0) +-------------------------+ | Avro-encoded bytes: | (Avro-encoded long offset) | rawBytes | +-------------------------+
- Specified by:
getPositionWireFormat
in interfacePubSubPosition
- Returns:
- the serialized
PubSubPositionWireFormat
containing the type and position bytes
-
getFactoryClass
Description copied from interface:PubSubPosition
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.- Specified by:
getFactoryClass
in interfacePubSubPosition
- Returns:
- the class object of the factory that can construct this position
-
getHeapSize
public int getHeapSize()- Specified by:
getHeapSize
in interfaceMeasurable
-