Interface IKeyValueStore
An interface to access key-value store.
Namespace: Libplanet.Store.Trie
Assembly: Libplanet.dll
Syntax
public interface IKeyValueStore : IDisposable
Methods
| Improve this Doc View SourceDelete(IEnumerable<KeyBytes>)
Delete multiple keys
at once.
Declaration
void Delete(IEnumerable<KeyBytes> keys)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<KeyBytes> | keys | Keys to delete. The order of keys does not matter. Non-existent keys are ignored. |
Delete(in KeyBytes)
Deletes the given key. If the key does not exist, nothing happens.
Declaration
void Delete(in KeyBytes key)
Parameters
Type | Name | Description |
---|---|---|
KeyBytes | key | A key to delete. |
Exists(in KeyBytes)
Checks whether the given key exists in the store.
Declaration
bool Exists(in KeyBytes key)
Parameters
Type | Name | Description |
---|---|---|
KeyBytes | key | A key to check. |
Returns
Type | Description |
---|---|
Boolean | true if the key exists; otherwise, false. |
Get(IEnumerable<KeyBytes>)
Gets multiple values associated with the specified keys at once.
Declaration
IReadOnlyDictionary<KeyBytes, byte[]> Get(IEnumerable<KeyBytes> keys)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<KeyBytes> | keys | Keys whose values to get. The order of keys does not matter. Duplicate keys after their first occurrence are ignored. |
Returns
Type | Description |
---|---|
IReadOnlyDictionary<KeyBytes, Byte[]> | Values associated the specified |
Get(in KeyBytes)
Gets the value associated with the specified key.
Declaration
byte[] Get(in KeyBytes key)
Parameters
Type | Name | Description |
---|---|---|
KeyBytes | key | The key whose value to get. |
Returns
Type | Description |
---|---|
Byte[] | The value associated with the specified key. |
ListKeys()
Lists all keys that have been stored in the storage.
Declaration
IEnumerable<KeyBytes> ListKeys()
Returns
Type | Description |
---|---|
IEnumerable<KeyBytes> | All keys in an arbitrary order. The order might be vary for each call. |
Set(IDictionary<KeyBytes, Byte[]>)
Sets all values in the given dictionary.
Declaration
void Set(IDictionary<KeyBytes, byte[]> values)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<KeyBytes, Byte[]> | values | A values to set. |
Set(in KeyBytes, Byte[])
Sets the value to the key. If the key already exists, the value is overwritten.
Declaration
void Set(in KeyBytes key, byte[] value)
Parameters
Type | Name | Description |
---|---|---|
KeyBytes | key | The key of the value to set. |
Byte[] | value | The value to set. |