Package com.linkedin.davinci.store
Class AbstractStoragePartition
java.lang.Object
com.linkedin.davinci.store.AbstractStoragePartition
- Direct Known Subclasses:
BlackHoleStorageEnginePartition
,InMemoryStoragePartition
,RocksDBStoragePartition
,VeniceStoreCacheStoragePartition
An abstract implementation of a storage partition. This could be a database in BDB
environment or a concurrent hashmap in the case of an in-memory implementation depending
on the storage-partition model.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
checkDatabaseIntegrity
(Map<String, String> checkpointedInfo) checks whether the current state of the database is valid during the start of ingestion.abstract void
close()
Close the specific partitionabstract void
Creates a snapshot of the current state of the storage if the blob transfer feature is enabled via the store configurationabstract void
delete
(byte[] key) Delete a key from the partition databasevoid
deleteWithReplicationMetadata
(byte[] key, byte[] metadata) This API deletes a record from RocksDB but updates the metadata in ByteBuffer format and puts it into RocksDB.abstract void
drop()
Drop when it is not required anymore.void
abstract byte[]
get
(byte[] key) Get a value from the partition databaseget
(byte[] key, ByteBuffer valueToBePopulated) abstract byte[]
get
(ByteBuffer key) abstract <K,
V> V get
(K key) Get a Value from the partition databaseabstract void
getByKeyPrefix
(byte[] keyPrefix, BytesStreamingCallback callback) Populate provided callback with key-value pairs from the partition database where the keys have provided prefix.returns the id of this partitionabstract long
Get the partition database size in bytesbyte[]
This API retrieves replication metadata from replicationMetadataColumnFamily.long
abstract void
put
(byte[] key, byte[] value) Puts a value into the partition databaseabstract void
put
(byte[] key, ByteBuffer value) abstract <K,
V> void put
(K key, V value) void
putReplicationMetadata
(byte[] key, byte[] metadata) void
putWithReplicationMetadata
(byte[] key, byte[] value, byte[] metadata) This API takes in value and metadata as byte array format and put it into RocksDB.void
putWithReplicationMetadata
(byte[] key, ByteBuffer value, byte[] metadata) This API takes in value and metadata as ByteBuffer format and put it into RocksDB.void
reopen()
Reopen the database.sync()
Sync current database.boolean
abstract boolean
verifyConfig
(StoragePartitionConfig storagePartitionConfig) Check whether current storage partition verifyConfig the given partition config
-
Field Details
-
partitionId
-
-
Constructor Details
-
AbstractStoragePartition
-
-
Method Details
-
getPartitionId
returns the id of this partition -
put
public abstract void put(byte[] key, byte[] value) Puts a value into the partition database -
put
-
put
public abstract <K,V> void put(K key, V value) -
get
public abstract byte[] get(byte[] key) Get a value from the partition database- Parameters:
key
- key to be retrieved- Returns:
- null if the key does not exist, byte[] value if it exists.
-
get
-
get
public abstract <K,V> V get(K key) Get a Value from the partition database- Type Parameters:
K
- the type for KeyV
- the type for the return value- Parameters:
key
- key to be retrieved- Returns:
- null if the key does not exist, V value if it exists
-
get
-
getByKeyPrefix
Populate provided callback with key-value pairs from the partition database where the keys have provided prefix. If prefix is null, callback will be populated will all key-value pairs from the partition database.- Parameters:
keyPrefix
-callback
-
-
delete
public abstract void delete(byte[] key) Delete a key from the partition database -
sync
Sync current database.- Returns:
- Database related info, which is required to be checkpointed.
-
drop
public abstract void drop()Drop when it is not required anymore. -
close
public abstract void close()Close the specific partition -
reopen
public void reopen()Reopen the database. -
verifyConfig
Check whether current storage partition verifyConfig the given partition config- Parameters:
storagePartitionConfig
-- Returns:
-
createSnapshot
public abstract void createSnapshot()Creates a snapshot of the current state of the storage if the blob transfer feature is enabled via the store configuration -
checkDatabaseIntegrity
checks whether the current state of the database is valid during the start of ingestion. -
beginBatchWrite
-
endBatchWrite
public void endBatchWrite() -
getPartitionSizeInBytes
public abstract long getPartitionSizeInBytes()Get the partition database size in bytes- Returns:
- partition database size
-
validateBatchIngestion
public boolean validateBatchIngestion() -
putWithReplicationMetadata
This API takes in value and metadata as ByteBuffer format and put it into RocksDB. OnlyReplicationMetadataRocksDBStoragePartition
will execute this method, other storage partition implementation will UnsupportedOperationException. -
putWithReplicationMetadata
public void putWithReplicationMetadata(byte[] key, byte[] value, byte[] metadata) This API takes in value and metadata as byte array format and put it into RocksDB. OnlyReplicationMetadataRocksDBStoragePartition
will execute this method, other storage partition implementation will VeniceUnsupportedOperationException. -
putReplicationMetadata
public void putReplicationMetadata(byte[] key, byte[] metadata) -
getReplicationMetadata
This API retrieves replication metadata from replicationMetadataColumnFamily. OnlyReplicationMetadataRocksDBStoragePartition
will execute this method, other storage partition implementation will VeniceUnsupportedOperationException. -
deleteWithReplicationMetadata
public void deleteWithReplicationMetadata(byte[] key, byte[] metadata) This API deletes a record from RocksDB but updates the metadata in ByteBuffer format and puts it into RocksDB. OnlyReplicationMetadataRocksDBStoragePartition
will execute this method, other storage partition implementation will VeniceUnsupportedOperationException. -
getRmdByteUsage
public long getRmdByteUsage() -
getIterator
-