Package com.linkedin.davinci.storage
Class StorageEngineMetadataService
java.lang.Object
com.linkedin.venice.service.AbstractVeniceService
com.linkedin.davinci.storage.StorageEngineMetadataService
- All Implemented Interfaces:
StorageMetadataService
,OffsetManager
,Closeable
,AutoCloseable
public class StorageEngineMetadataService
extends AbstractVeniceService
implements StorageMetadataService
StorageEngineMetadataService is wrapper service on top of storageEngineRepository to serve read/write to storage metadata.
It contains methods to read/write/clear the store version state and partition offset that are stored in metadata partition.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceService
AbstractVeniceService.ServiceState
-
Field Summary
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState
-
Constructor Summary
ConstructorDescriptionStorageEngineMetadataService
(StorageEngineRepository storageEngineRepository, InternalAvroSpecificSerializer<PartitionState> serializer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clearOffset
(String topicName, int partitionId) void
clearStoreVersionState
(String topicName) This will clear all metadata, including store-version state and partition states, tied to .void
computeStoreVersionState
(String topicName, Function<StoreVersionState, StoreVersionState> mapFunction) getLastOffset
(String topicName, int partitionId) Gets the Last Known persisted offset of this consumer.getStoreVersionState
(String topicName) Gets the currently-persistedStoreVersionState
for this topic.void
put
(String topicName, int partitionId, OffsetRecord record) Records the offset with underlying/external storage.boolean
void
Methods inherited from class com.linkedin.venice.service.AbstractVeniceService
close, getName, isRunning, start, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linkedin.davinci.storage.StorageMetadataService
getStoreVersionCompressionDictionary
-
Constructor Details
-
StorageEngineMetadataService
public StorageEngineMetadataService(StorageEngineRepository storageEngineRepository, InternalAvroSpecificSerializer<PartitionState> serializer)
-
-
Method Details
-
put
Description copied from interface:OffsetManager
Records the offset with underlying/external storage. Persistence to disk happens in configurable time interval by a background thread. For example in case of BDB the check pointer thread can be configured to do this.- Specified by:
put
in interfaceOffsetManager
- Parameters:
topicName
- kafka topic to which the consumer thread is registered to.partitionId
- kafka partition id for which the consumer thread is registered to.record
- OffSetRecord containing last read offset for the topic and partition combination.- Throws:
VeniceException
-
clearOffset
- Specified by:
clearOffset
in interfaceOffsetManager
-
getLastOffset
Description copied from interface:OffsetManager
Gets the Last Known persisted offset of this consumer.- Specified by:
getLastOffset
in interfaceOffsetManager
- Parameters:
topicName
- kafka topic to which the consumer thread is registered to.partitionId
- kafka partition id for which the consumer thread is registered to.- Returns:
- OffsetRecord - contains offset and time when it was recorded before the consumer thread went down. consumer
- Throws:
VeniceException
-
startInner
- Specified by:
startInner
in classAbstractVeniceService
- Returns:
- true if the service is completely started,
false if it is still starting asynchronously (in this case, it is the implementer's
responsibility to set
AbstractVeniceService.serviceState
toAbstractVeniceService.ServiceState.STARTED
upon completion of the async work). - Throws:
Exception
-
stopInner
- Specified by:
stopInner
in classAbstractVeniceService
- Throws:
Exception
-
computeStoreVersionState
public void computeStoreVersionState(String topicName, Function<StoreVersionState, StoreVersionState> mapFunction) throws VeniceException- Specified by:
computeStoreVersionState
in interfaceStorageMetadataService
- Throws:
VeniceException
-
clearStoreVersionState
Description copied from interface:StorageMetadataService
This will clear all metadata, including store-version state and partition states, tied to .- Specified by:
clearStoreVersionState
in interfaceStorageMetadataService
- Parameters:
topicName
- to be cleared
-
getStoreVersionState
Description copied from interface:StorageMetadataService
Gets the currently-persistedStoreVersionState
for this topic.- Specified by:
getStoreVersionState
in interfaceStorageMetadataService
- Parameters:
topicName
- kafka topic to which the consumer thread is registered to.- Returns:
- an instance of
StoreVersionState
corresponding to this topic, or null if there isn't any. - Throws:
VeniceException
-