Class ApacheKafkaOffsetPosition
- java.lang.Object
-
- com.linkedin.venice.pubsub.adapter.kafka.ApacheKafkaOffsetPosition
-
- All Implemented Interfaces:
PubSubPosition
public class ApacheKafkaOffsetPosition extends java.lang.Object implements PubSubPosition
Offset position for Apache Kafka topics
-
-
Constructor Summary
Constructors Constructor Description ApacheKafkaOffsetPosition(long offset)
ApacheKafkaOffsetPosition(java.nio.ByteBuffer buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
comparePosition(PubSubPosition other)
long
diff(PubSubPosition other)
boolean
equals(java.lang.Object other)
long
getOffset()
PubSubPositionWireFormat
getPositionWireFormat()
Position wrapper is used to wrap the position type and the position value.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
ApacheKafkaOffsetPosition
public ApacheKafkaOffsetPosition(long offset)
-
ApacheKafkaOffsetPosition
public ApacheKafkaOffsetPosition(java.nio.ByteBuffer buffer) throws java.io.IOException
- Parameters:
buffer
- the buffer to read from. The ByteBuffer expected to contain avro serialized long- Throws:
java.io.IOException
- if the buffer is not a valid avro serialized long
-
-
Method Detail
-
comparePosition
public int comparePosition(PubSubPosition other)
- Specified by:
comparePosition
in interfacePubSubPosition
- Parameters:
other
- the other position to compare to- Returns:
- returns 0 if the positions are equal, -1 if this position is less than the other position, and 1 if this position is greater than the other position
-
diff
public long diff(PubSubPosition other)
- Specified by:
diff
in interfacePubSubPosition
- Returns:
- the difference between this position and the other position
- Throws:
java.lang.IllegalArgumentException
- if position is null or positions are not comparable
-
getOffset
public long getOffset()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Specified by:
equals
in interfacePubSubPosition
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacePubSubPosition
- Overrides:
hashCode
in classjava.lang.Object
-
getPositionWireFormat
public 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.- Specified by:
getPositionWireFormat
in interfacePubSubPosition
- Returns:
- the position wrapper
-
-