Class ApacheKafkaOffsetPosition
java.lang.Object
com.linkedin.venice.pubsub.adapter.kafka.common.ApacheKafkaOffsetPosition
- All Implemented Interfaces:
Measurable
,PubSubPosition
Offset position for Apache Kafka topics
-
Constructor Summary
ConstructorsConstructorDescriptionApacheKafkaOffsetPosition
(long offset) ApacheKafkaOffsetPosition
(ByteBuffer buffer) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
getWireFormatBytes
-
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
-
getOffset
public long getOffset() -
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
-
getHeapSize
public int getHeapSize()- Specified by:
getHeapSize
in interfaceMeasurable
-