Package com.linkedin.davinci.store
Interface StorageEngine<Partition extends AbstractStoragePartition>
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AbstractStorageEngine,BlackHoleStorageEngine,DelegatingStorageEngine,InMemoryStorageEngine,RocksDBStorageEngine,VeniceStoreCacheStorageEngine
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddStoragePartition(StoragePartitionConfig storagePartitionConfig) voidaddStoragePartitionIfAbsent(int partitionId) voidadjustStoragePartition(int partitionId, StoragePartitionAdjustmentTrigger mode, StoragePartitionConfig partitionConfig) Adjust the opened storage partition according to the provided storagePartitionConfig.voidbeginBatchWrite(StoragePartitionConfig storagePartitionConfig, Map<String, String> checkpointedInfo, Optional<Supplier<byte[]>> checksumSupplier) A lot of storage engines support efficient methods for performing large number of writes (puts/deletes) against the data source.booleancheckDatabaseIntegrity(int partitionId, Map<String, String> checkpointedInfo, StoragePartitionConfig storagePartitionConfig) checks whether the current state of the database is valid during the start of ingestion.voidclearPartitionOffset(int partitionId) Clear the offset associated with the partitionId in the metadata partition.voidClear the store version state in the metadata partition.voidclose()voidvoidclosePartition(int partitionId) booleancontainsPartition(int partitionId) Return true or false based on whether a given partition exists within this storage enginevoiddelete(int partitionId, byte[] key) voiddeleteWithReplicationMetadata(int partitionId, byte[] key, byte[] replicationMetadata) voiddrop()Drop the whole storevoiddropPartition(int partitionId) Removes and returns a partition from the current storevoiddropPartition(int partitionId, boolean dropMetadataPartitionWhenEmpty) Removes and returns a partition from the current storevoidendBatchWrite(StoragePartitionConfig storagePartitionConfig) byte[]get(int partitionId, byte[] key) get(int partitionId, byte[] key, ByteBuffer valueToBePopulated) byte[]get(int partitionId, ByteBuffer keyBuffer) voidgetByKeyPrefix(int partitionId, byte[] partialKey, BytesStreamingCallback bytesStreamingCallback) getIterator(int partitionId) Get all Partition Ids which are assigned to the current Node.getPartitionOffset(int partitionId, PubSubContext pubSubContext) Retrieve the offset associated with the partitionId from the metadata partition.getPartitionOrThrow(int partitionId) byte[]getReplicationMetadata(int partitionId, ByteBuffer key) default StorageEngineStatsgetStats()Retrieve the store version state from the metadata partition.getType()booleanisClosed()voidput(int partitionId, byte[] key, byte[] value) voidput(int partitionId, byte[] key, ByteBuffer value) voidputPartitionOffset(int partitionId, OffsetRecord offsetRecord) Put the offset associated with the partitionId into the metadata partition.voidputReplicationMetadata(int partitionId, byte[] key, byte[] replicationMetadata) voidputStoreVersionState(StoreVersionState versionState) Put the store version state into the metadata partition.voidputWithReplicationMetadata(int partitionId, byte[] key, ByteBuffer value, byte[] replicationMetadata) voidreopenStoragePartition(int partitionId) Reopen the underlying database.voidsuppressLogs(boolean b) sync(int partitionId) voidupdateStoreVersionStateCache(StoreVersionState versionState) Used in ingestion isolation mode update the storage engine's cache in sync with the updates to the state inMainIngestionStorageMetadataService
-
Method Details
-
getStoreVersionName
String getStoreVersionName() -
getType
PersistenceType getType() -
getPersistedPartitionIds
-
adjustStoragePartition
void adjustStoragePartition(int partitionId, StoragePartitionAdjustmentTrigger mode, StoragePartitionConfig partitionConfig) Adjust the opened storage partition according to the provided storagePartitionConfig. It will throw exception if there is no opened storage partition for the given partition id. The reason to have is mainly used to ease the unit test. -
addStoragePartitionIfAbsent
void addStoragePartitionIfAbsent(int partitionId) -
addStoragePartition
-
closePartition
void closePartition(int partitionId) -
closeMetadataPartition
void closeMetadataPartition() -
dropPartition
void dropPartition(int partitionId) Removes and returns a partition from the current store- Parameters:
partitionId- - id of partition to retrieve and remove
-
dropPartition
void dropPartition(int partitionId, boolean dropMetadataPartitionWhenEmpty) Removes and returns a partition from the current store- Parameters:
partitionId- - id of partition to retrieve and removedropMetadataPartitionWhenEmpty- - if true, the whole store will be dropped if ALL partitions are removed
-
drop
void drop()Drop the whole store -
sync
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
VeniceException
-
isClosed
boolean isClosed() -
checkDatabaseIntegrity
boolean checkDatabaseIntegrity(int partitionId, Map<String, String> checkpointedInfo, StoragePartitionConfig storagePartitionConfig) checks whether the current state of the database is valid during the start of ingestion. -
beginBatchWrite
void beginBatchWrite(StoragePartitionConfig storagePartitionConfig, Map<String, String> checkpointedInfo, Optional<Supplier<byte[]>> checksumSupplier) A lot of storage engines support efficient methods for performing large number of writes (puts/deletes) against the data source. This method puts the storage engine in this batch write mode -
endBatchWrite
-
reopenStoragePartition
void reopenStoragePartition(int partitionId) Reopen the underlying database. -
put
- Throws:
VeniceException
-
put
- Throws:
VeniceException
-
putWithReplicationMetadata
void putWithReplicationMetadata(int partitionId, byte[] key, ByteBuffer value, byte[] replicationMetadata) throws VeniceException - Throws:
VeniceException
-
putReplicationMetadata
void putReplicationMetadata(int partitionId, byte[] key, byte[] replicationMetadata) throws VeniceException - Throws:
VeniceException
-
get
- Throws:
VeniceException
-
get
- Throws:
VeniceException
-
get
- Throws:
VeniceException
-
getByKeyPrefix
void getByKeyPrefix(int partitionId, byte[] partialKey, BytesStreamingCallback bytesStreamingCallback) -
delete
- Throws:
VeniceException
-
deleteWithReplicationMetadata
void deleteWithReplicationMetadata(int partitionId, byte[] key, byte[] replicationMetadata) throws VeniceException - Throws:
VeniceException
-
getReplicationMetadata
-
putPartitionOffset
Put the offset associated with the partitionId into the metadata partition. -
getPartitionOffset
Retrieve the offset associated with the partitionId from the metadata partition. -
clearPartitionOffset
void clearPartitionOffset(int partitionId) Clear the offset associated with the partitionId in the metadata partition. -
putStoreVersionState
Put the store version state into the metadata partition. -
updateStoreVersionStateCache
Used in ingestion isolation mode update the storage engine's cache in sync with the updates to the state inMainIngestionStorageMetadataService -
getStoreVersionState
StoreVersionState getStoreVersionState()Retrieve the store version state from the metadata partition. -
clearStoreVersionState
void clearStoreVersionState()Clear the store version state in the metadata partition. -
containsPartition
boolean containsPartition(int partitionId) Return true or false based on whether a given partition exists within this storage engine- Parameters:
partitionId- The partition to look for- Returns:
- True/False, does the partition exist on this node
-
getPartitionIds
Get all Partition Ids which are assigned to the current Node.- Returns:
- partition Ids that are hosted in the current Storage Engine.
-
getPartitionOrThrow
-
getIterator
-
suppressLogs
void suppressLogs(boolean b) -
getStats
-