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 TypeMethodDescriptionbooleanClass<? extends PubSubPositionFactory>Returns the factory class responsible for creating this position type.intlonglongReturns 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.inthashCode()static ApacheKafkaOffsetPositionof(long offset) static ApacheKafkaOffsetPositionof(ByteBuffer buffer) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
equalsin interfacePubSubPosition- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfacePubSubPosition- Overrides:
hashCodein classObject
-
getNumericOffset
public long getNumericOffset()- Specified by:
getNumericOffsetin 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 transmitPubSubPositioninstances over the wire.Example (ApacheKafkaOffsetPosition):
+-------------------------+ | Avro-encoded int: type | (e.g., 0) +-------------------------+ | Avro-encoded bytes: | (Avro-encoded long offset) | rawBytes | +-------------------------+
- Specified by:
getPositionWireFormatin interfacePubSubPosition- Returns:
- the serialized
PubSubPositionWireFormatcontaining the type and position bytes
-
getFactoryClass
Description copied from interface:PubSubPositionReturns 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:
getFactoryClassin interfacePubSubPosition- Returns:
- the class object of the factory that can construct this position
-
getHeapSize
public int getHeapSize()- Specified by:
getHeapSizein interfaceMeasurable
-