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,java.io.Closeable,java.lang.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
Constructors Constructor Description StorageEngineMetadataService(StorageEngineRepository storageEngineRepository, InternalAvroSpecificSerializer<PartitionState> serializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearOffset(java.lang.String topicName, int partitionId)voidclearStoreVersionState(java.lang.String topicName)This will clear all metadata, including store-version state and partition states, tied to {@param topicName}.voidcomputeStoreVersionState(java.lang.String topicName, java.util.function.Function<StoreVersionState,StoreVersionState> mapFunction)OffsetRecordgetLastOffset(java.lang.String topicName, int partitionId)Gets the Last Known persisted offset of this consumer.StoreVersionStategetStoreVersionState(java.lang.String topicName)Gets the currently-persistedStoreVersionStatefor this topic.voidput(java.lang.String topicName, int partitionId, OffsetRecord record)Records the offset with underlying/external storage.booleanstartInner()voidstopInner()-
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 Detail
-
StorageEngineMetadataService
public StorageEngineMetadataService(StorageEngineRepository storageEngineRepository, InternalAvroSpecificSerializer<PartitionState> serializer)
-
-
Method Detail
-
put
public void put(java.lang.String topicName, int partitionId, OffsetRecord record) throws VeniceExceptionDescription copied from interface:OffsetManagerRecords 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:
putin 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
public void clearOffset(java.lang.String topicName, int partitionId)- Specified by:
clearOffsetin interfaceOffsetManager
-
getLastOffset
public OffsetRecord getLastOffset(java.lang.String topicName, int partitionId) throws VeniceException
Description copied from interface:OffsetManagerGets the Last Known persisted offset of this consumer.- Specified by:
getLastOffsetin 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
public boolean startInner() throws java.lang.Exception- Specified by:
startInnerin 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.serviceStatetoAbstractVeniceService.ServiceState.STARTEDupon completion of the async work). - Throws:
java.lang.Exception
-
stopInner
public void stopInner() throws java.lang.Exception- Specified by:
stopInnerin classAbstractVeniceService- Throws:
java.lang.Exception
-
computeStoreVersionState
public void computeStoreVersionState(java.lang.String topicName, java.util.function.Function<StoreVersionState,StoreVersionState> mapFunction) throws VeniceException- Specified by:
computeStoreVersionStatein interfaceStorageMetadataService- Throws:
VeniceException
-
clearStoreVersionState
public void clearStoreVersionState(java.lang.String topicName)
Description copied from interface:StorageMetadataServiceThis will clear all metadata, including store-version state and partition states, tied to {@param topicName}.- Specified by:
clearStoreVersionStatein interfaceStorageMetadataService- Parameters:
topicName- to be cleared
-
getStoreVersionState
public StoreVersionState getStoreVersionState(java.lang.String topicName) throws VeniceException
Description copied from interface:StorageMetadataServiceGets the currently-persistedStoreVersionStatefor this topic.- Specified by:
getStoreVersionStatein interfaceStorageMetadataService- Parameters:
topicName- kafka topic to which the consumer thread is registered to.- Returns:
- an instance of
StoreVersionStatecorresponding to this topic, or null if there isn't any. - Throws:
VeniceException
-
-