Class RocksDBKeyValueStore
The RocksDB IKey
Rocksrocksdb+file:
scheme
using
rocksdb+file:///var/data/planet/
rocksdb+file:///c:/Users/john/AppData/Local/planet/
rocksdb+file:///var/data/planet/?secure=true
(trie keys are hashed)
The following query string parameters are supported:
block-cache | Corresponds to
RocksblockCacheSize parameter. 512 by default. |
tx-cache | Corresponds to
RockstxCacheSize parameter. 1024 by default. |
max-total-wal-size | Corresponds to RocksDB's max_total_wal_size option. |
keep-log-file-num | Corresponds to RocksDB's keep_log_file_num option. |
max_log_file_size | Corresponds to RocksDB's max_log_file_size option. |
tx-epoch-unit-secs | Corresponds to
RockstxEpochUnitSeconds parameter. 86400 by default. |
block-epoch-unit-secs | Corresponds to
RocksblockEpochUnitSeconds parameter. 86400 by default. |
connection-cache | Corresponds to
RocksdbConnectionCacheSize parameter. 100 by default. |
states-dir | Corresponds to Rockspath
parameter. It is relative to the URI path, and defaults to states . |
secure | true or false (default). Corresponds to
Triesecure parameter. |
Inherited Members
Namespace: Libplanet.RocksDBStore
Assembly: Libplanet.RocksDBStore.dll
Syntax
public class RocksDBKeyValueStore : IKeyValueStore, IDisposable
Constructors
| Improve this Doc View SourceRocksDBKeyValueStore(String)
Creates a new Rocks
Declaration
public RocksDBKeyValueStore(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the storage file will be saved. |
Methods
| Improve this Doc View SourceDelete(in KeyBytes)
Deletes the given key. If the key does not exist, nothing happens.
Declaration
public void Delete(in KeyBytes key)
Parameters
Type | Name | Description |
---|---|---|
Key |
key | A key to delete. |
Delete(IEnumerable<KeyBytes>)
Delete multiple keys
at once.
Declaration
public void Delete(IEnumerable<KeyBytes> keys)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Key |
keys | Keys to delete. The order of keys does not matter. Non-existent keys are ignored. |
Dispose()
The RocksDB IKey
Rocksrocksdb+file:
scheme
using
rocksdb+file:///var/data/planet/
rocksdb+file:///c:/Users/john/AppData/Local/planet/
rocksdb+file:///var/data/planet/?secure=true
(trie keys are hashed)
The following query string parameters are supported:
block-cache | Corresponds to
RocksblockCacheSize parameter. 512 by default. |
tx-cache | Corresponds to
RockstxCacheSize parameter. 1024 by default. |
max-total-wal-size | Corresponds to RocksDB's max_total_wal_size option. |
keep-log-file-num | Corresponds to RocksDB's keep_log_file_num option. |
max_log_file_size | Corresponds to RocksDB's max_log_file_size option. |
tx-epoch-unit-secs | Corresponds to
RockstxEpochUnitSeconds parameter. 86400 by default. |
block-epoch-unit-secs | Corresponds to
RocksblockEpochUnitSeconds parameter. 86400 by default. |
connection-cache | Corresponds to
RocksdbConnectionCacheSize parameter. 100 by default. |
states-dir | Corresponds to Rockspath
parameter. It is relative to the URI path, and defaults to states . |
secure | true or false (default). Corresponds to
Triesecure parameter. |
Declaration
public void Dispose()
Exists(in KeyBytes)
Checks whether the given key exists in the store.
Declaration
public bool Exists(in KeyBytes key)
Parameters
Type | Name | Description |
---|---|---|
Key |
key | A key to check. |
Returns
Type | Description |
---|---|
Boolean | true if the key exists; otherwise, false. |
Get(in KeyBytes)
Gets the value associated with the specified key.
Declaration
public byte[] Get(in KeyBytes key)
Parameters
Type | Name | Description |
---|---|---|
Key |
key | The key whose value to get. |
Returns
Type | Description |
---|---|
Byte[] | The value associated with the specified key. |
Exceptions
Type | Condition |
---|---|
Key |
Thrown when the key is not found. |
Get(IEnumerable<KeyBytes>)
Gets multiple values associated with the specified keys at once.
Declaration
public IReadOnlyDictionary<KeyBytes, byte[]> Get(IEnumerable<KeyBytes> keys)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Key |
keys | Keys whose values to get. The order of keys does not matter. Duplicate keys after their first occurrence are ignored. |
Returns
Type | Description |
---|---|
IRead |
Values associated the specified |
ListKeys()
Lists all keys that have been stored in the storage.
Declaration
public IEnumerable<KeyBytes> ListKeys()
Returns
Type | Description |
---|---|
IEnumerable<Key |
All keys in an arbitrary order. The order might be vary for each call. |
Set(in KeyBytes, Byte[])
Sets the value to the key. If the key already exists, the value is overwritten.
Declaration
public void Set(in KeyBytes key, byte[] value)
Parameters
| Improve this Doc View SourceSet(IDictionary<KeyBytes, Byte[]>)
Sets all values in the given dictionary.
Declaration
public void Set(IDictionary<KeyBytes, byte[]> values)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<Key |
values | A values to set. |