K - the type of keys maintained by this key-value store.V - the type of values maintained by this key-value store.public interface KeyValueStore<K,V>
| Modifier and Type | Method and Description |
|---|---|
KeyValueIterator<K,V> |
all()
Returns an iterator for all entries in this key-value store.
|
java.util.Optional<java.nio.file.Path> |
checkpoint(CheckpointId id)
Create a persistent checkpoint / snapshot of the current store state and return it's path.
|
void |
close()
Closes this key-value store, if applicable, relinquishing any underlying resources.
|
void |
delete(K key)
Deletes the mapping for the specified
key from this key-value store (if such mapping exists). |
default void |
deleteAll(java.util.List<K> keys)
Deletes the mappings for the specified
keys from this key-value store (if such mappings exist). |
void |
flush()
Flushes this key-value store, if applicable.
|
V |
get(K key)
Gets the value associated with the specified
key. |
default java.util.Map<K,V> |
getAll(java.util.List<K> keys)
Gets the values with which the specified
keys are associated. |
void |
put(K key,
V value)
Updates the mapping of the specified key-value pair; Associates the specified
key with the specified value. |
void |
putAll(java.util.List<Entry<K,V>> entries)
Updates the mappings of the specified key-value
entries. |
KeyValueIterator<K,V> |
range(K from,
K to)
Returns an iterator for a sorted range of entries specified by [
from, to). |
default KeyValueSnapshot<K,V> |
snapshot(K from,
K to)
Returns a snapshot of this store for a sorted range of entries specified by [
from, to). |
V get(K key)
key.key - the key with which the associated value is to be fetched.key; otherwise, null.java.lang.NullPointerException - if the specified key is null.default java.util.Map<K,V> getAll(java.util.List<K> keys)
keys are associated.keys - the keys with which the associated values are to be fetched.java.lang.NullPointerException - if the specified keys list, or any of the keys, is null.void put(K key, V value)
key with the specified value.key - the key with which the specified value is to be associated.value - the value with which the specified key is to be associated.java.lang.NullPointerException - if the specified key or value is null.void putAll(java.util.List<Entry<K,V>> entries)
entries.entries - the updated mappings to put into this key-value store.java.lang.NullPointerException - if any of the specified entries has null as key or value.void delete(K key)
key from this key-value store (if such mapping exists).key - the key for which the mapping is to be deleted.java.lang.NullPointerException - if the specified key is null.default void deleteAll(java.util.List<K> keys)
keys from this key-value store (if such mappings exist).keys - the keys for which the mappings are to be deleted.java.lang.NullPointerException - if the specified keys list, or any of the keys, is null.KeyValueIterator<K,V> range(K from, K to)
from, to).
API Note: The returned iterator MUST be closed after use. The comparator used for finding entries that belong to the specified range compares the underlying serialized big-endian byte array representation of keys, lexicographically.
from - the key specifying the low endpoint (inclusive) of the keys in the returned range.to - the key specifying the high endpoint (exclusive) of the keys in the returned range.java.lang.NullPointerException - if null is used for from or to.default KeyValueSnapshot<K,V> snapshot(K from, K to)
from, to).
The snapshot is immutable - ie., any mutations to the store are not reflected in the snapshot after it is created.
API Note: The returned snapshot MUST be closed after use.
from - the key specifying the low endpoint (inclusive) of the keys in the returned range.to - the key specifying the high endpoint (exclusive) of the keys in the returned range.java.lang.NullPointerException - if null is used for from or to.KeyValueIterator<K,V> all()
API Note: The returned iterator MUST be closed after use.
void close()
void flush()
@InterfaceStability.Unstable java.util.Optional<java.nio.file.Path> checkpoint(CheckpointId id)