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 TypeMethodDescriptionvoid
addStoragePartition
(int partitionId) void
adjustStoragePartition
(int partitionId, StoragePartitionAdjustmentTrigger mode, StoragePartitionConfig partitionConfig) Adjust the opened storage partition according to the provided storagePartitionConfig.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.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.void
clearPartitionOffset
(int partitionId) Clear the offset associated with the partitionId in the metadata partition.void
Clear the store version state in the metadata partition.void
close()
void
void
closePartition
(int partitionId) boolean
containsPartition
(int partitionId) Return true or false based on whether a given partition exists within this storage enginevoid
delete
(int partitionId, byte[] key) void
deleteWithReplicationMetadata
(int partitionId, byte[] key, byte[] replicationMetadata) void
drop()
Drop the whole storevoid
dropPartition
(int partitionId) Removes and returns a partition from the current storevoid
dropPartition
(int partitionId, boolean dropMetadataPartitionWhenEmpty) Removes and returns a partition from the current storevoid
endBatchWrite
(StoragePartitionConfig storagePartitionConfig) byte[]
get
(int partitionId, byte[] key) get
(int partitionId, byte[] key, ByteBuffer valueToBePopulated) byte[]
get
(int partitionId, ByteBuffer keyBuffer) void
getByKeyPrefix
(int partitionId, byte[] partialKey, BytesStreamingCallback bytesStreamingCallback) getIterator
(int partitionId) Get all Partition Ids which are assigned to the current Node.getPartitionOffset
(int partitionId) Retrieve the offset associated with the partitionId from the metadata partition.getPartitionOrThrow
(int partitionId) byte[]
getReplicationMetadata
(int partitionId, ByteBuffer key) default StorageEngineStats
getStats()
Retrieve the store version state from the metadata partition.getType()
boolean
isClosed()
void
put
(int partitionId, byte[] key, byte[] value) void
put
(int partitionId, byte[] key, ByteBuffer value) void
putPartitionOffset
(int partitionId, OffsetRecord offsetRecord) Put the offset associated with the partitionId into the metadata partition.void
putReplicationMetadata
(int partitionId, byte[] key, byte[] replicationMetadata) void
putStoreVersionState
(StoreVersionState versionState) Put the store version state into the metadata partition.void
putWithReplicationMetadata
(int partitionId, byte[] key, ByteBuffer value, byte[] replicationMetadata) void
reopenStoragePartition
(int partitionId) Reopen the underlying database.void
suppressLogs
(boolean b) sync
(int partitionId) void
updateStoreVersionStateCache
(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. -
addStoragePartition
void addStoragePartition(int partitionId) -
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:
close
in interfaceAutoCloseable
- Specified by:
close
in 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
-