Show / Hide Table of Contents

Class RocksDBKeyValueStore

The RocksDB IKeyValueStore implementation. This stores data in the RocksDB.

RocksDBStore and RocksDBKeyValueStore-backed can be instantiated from a URI with rocksdb+file: scheme using , e.g.:

  • rocksdb+file:///var/data/planet/
  • rocksdb+file:///c:/Users/john/AppData/Local/planet/

The following query string parameters are supported:

block-cacheCorresponds to 's blockCacheSize parameter. 512 by default.
tx-cacheCorresponds to 's txCacheSize parameter. 1024 by default.
max-total-wal-sizeCorresponds to RocksDB's max_total_wal_size option.
keep-log-file-numCorresponds to RocksDB's keep_log_file_num option.
max_log_file_sizeCorresponds to RocksDB's max_log_file_size option.
tx-epoch-unit-secsCorresponds to 's txEpochUnitSeconds parameter. 86400 by default.
block-epoch-unit-secsCorresponds to 's blockEpochUnitSeconds parameter. 86400 by default.
connection-cacheCorresponds to 's dbConnectionCacheSize parameter. 100 by default.
states-dirCorresponds to 's path parameter. It is relative to the URI path, and defaults to states.
Inheritance
Object
RocksDBKeyValueStore
Implements
IKeyValueStore
IDisposable
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Libplanet.RocksDBStore
Assembly: Libplanet.RocksDBStore.dll
Syntax
public class RocksDBKeyValueStore : IKeyValueStore, IDisposable

Constructors

| Improve this Doc View Source

RocksDBKeyValueStore(String, Boolean)

Creates a new RocksDBKeyValueStore.

Declaration
public RocksDBKeyValueStore(string path, bool readonly = false)
Parameters
Type Name Description
String path

The path of the storage file will be saved.

Boolean readonly

If it is true, it will open rocksdb in read-only mode.

Methods

| Improve this Doc View Source

Delete(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
KeyBytes key

A key to delete.

| Improve this Doc View Source

Delete(IEnumerable<KeyBytes>)

Delete multiple keys at once.

Declaration
public 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.

| Improve this Doc View Source

Dispose()

The RocksDB IKeyValueStore implementation. This stores data in the RocksDB.

RocksDBStore and RocksDBKeyValueStore-backed can be instantiated from a URI with rocksdb+file: scheme using , e.g.:

  • rocksdb+file:///var/data/planet/
  • rocksdb+file:///c:/Users/john/AppData/Local/planet/

The following query string parameters are supported:

block-cacheCorresponds to 's blockCacheSize parameter. 512 by default.
tx-cacheCorresponds to 's txCacheSize parameter. 1024 by default.
max-total-wal-sizeCorresponds to RocksDB's max_total_wal_size option.
keep-log-file-numCorresponds to RocksDB's keep_log_file_num option.
max_log_file_sizeCorresponds to RocksDB's max_log_file_size option.
tx-epoch-unit-secsCorresponds to 's txEpochUnitSeconds parameter. 86400 by default.
block-epoch-unit-secsCorresponds to 's blockEpochUnitSeconds parameter. 86400 by default.
connection-cacheCorresponds to 's dbConnectionCacheSize parameter. 100 by default.
states-dirCorresponds to 's path parameter. It is relative to the URI path, and defaults to states.
Declaration
public void Dispose()
| Improve this Doc View Source

Exists(in KeyBytes)

Checks whether the given key exists in the store.

Declaration
public 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.

| Improve this Doc View Source

Get(in KeyBytes)

Gets the value associated with the specified key.

Declaration
public 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.

Exceptions
Type Condition
KeyNotFoundException

Thrown when the key is not found.

| Improve this Doc View Source

ListKeys()

Lists all keys that have been stored in the storage.

Declaration
public IEnumerable<KeyBytes> ListKeys()
Returns
Type Description
IEnumerable<KeyBytes>

All keys in an arbitrary order. The order might be vary for each call.

| Improve this Doc View Source

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
Type Name Description
KeyBytes key

The key of the value to set.

Byte[] value

The value to set.

| Improve this Doc View Source

Set(IDictionary<KeyBytes, Byte[]>)

Sets all values in the given dictionary.

Declaration
public void Set(IDictionary<KeyBytes, byte[]> values)
Parameters
Type Name Description
IDictionary<KeyBytes, Byte[]> values

A values to set.

Implements

IKeyValueStore
System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium