Package com.linkedin.venice.pubsub.mock
Class InMemoryPubSubPosition
java.lang.Object
com.linkedin.venice.pubsub.mock.InMemoryPubSubPosition
- All Implemented Interfaces:
Measurable
,PubSubPosition
-
Method Summary
Modifier and TypeMethodDescriptionboolean
int
long
Returns the internal offset used by this implementation.OnlyInMemoryPubSubPosition
supports this kind of APIlong
getPositionAfterNRecords
(long n) Get position that is after the current position by n records.Position wrapper is used to wrap the position type and the position value.int
hashCode()
static InMemoryPubSubPosition
of
(long offset) 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
-
Method Details
-
getNumericOffset
public long getNumericOffset()- Specified by:
getNumericOffset
in interfacePubSubPosition
-
getInternalOffset
public long getInternalOffset()Returns the internal offset used by this implementation.This method was added to support test cases that rely on accessing the internal offset directly, without depending on
getNumericOffset()
, which will be removed from the interface in the future.- Returns:
- the internal offset value
-
of
-
getPositionWireFormat
Description copied from interface:PubSubPosition
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
-
getHeapSize
public int getHeapSize()- Specified by:
getHeapSize
in interfaceMeasurable
-
getNextPosition
OnlyInMemoryPubSubPosition
supports this kind of API- Returns:
- a new
InMemoryPubSubPosition
with the internal offset incremented by 1
-
getPreviousPosition
-
getPositionAfterNRecords
Get position that is after the current position by n records.- Parameters:
n
- the number of records to skip- Returns:
- a new
InMemoryPubSubPosition
with the internal offset incremented by n
-
toString
-
equals
- Specified by:
equals
in interfacePubSubPosition
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfacePubSubPosition
- Overrides:
hashCode
in classObject
-