Package com.linkedin.venice.pubsub.mock
Class InMemoryPubSubPosition
java.lang.Object
com.linkedin.venice.pubsub.mock.InMemoryPubSubPosition
- All Implemented Interfaces:
Measurable
,PubSubPosition
-
Field Summary
FieldsFields inherited from interface com.linkedin.venice.pubsub.api.PubSubPosition
PUBSUB_POSITION_WIRE_FORMAT_SERIALIZER
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Class<? extends PubSubPositionFactory>
Returns the factory class responsible for creating this position type.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) static InMemoryPubSubPosition
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
-
Field Details
-
INMEMORY_PUBSUB_POSITION_TYPE_ID
public static final int INMEMORY_PUBSUB_POSITION_TYPE_ID- See Also:
-
-
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
-
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
-
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
-
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
-