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 TypeMethodDescriptionbooleanClass<? extends PubSubPositionFactory>Returns the factory class responsible for creating this position type.intlongReturns the internal offset used by this implementation.OnlyInMemoryPubSubPositionsupports this kind of APIlonggetPositionAfterNRecords(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.inthashCode()static InMemoryPubSubPositionof(long offset) static InMemoryPubSubPositionof(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
-
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:
getNumericOffsetin 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:PubSubPositionPosition 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:
getPositionWireFormatin interfacePubSubPosition- Returns:
- the position wrapper
-
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
-
getNextPosition
OnlyInMemoryPubSubPositionsupports this kind of API- Returns:
- a new
InMemoryPubSubPositionwith 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
InMemoryPubSubPositionwith the internal offset incremented by n
-
toString
-
equals
- Specified by:
equalsin interfacePubSubPosition- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfacePubSubPosition- Overrides:
hashCodein classObject
-