Show / Hide Table of Contents

Class DefaultKeyValueStore

The default built-in IKeyValueStore implementation. This stores data in the file system or in memory.

Inheritance
Object
DefaultKeyValueStore
Implements
IKeyValueStore
IDisposable
Namespace: Libplanet.Store.Trie
Assembly: Libplanet.dll
Syntax
public class DefaultKeyValueStore : object, IKeyValueStore, IDisposable

Constructors

| Improve this Doc View Source

DefaultKeyValueStore(Nullable<String>)

Creates a new DefaultKeyValueStore.

Declaration
public DefaultKeyValueStore(string? path)
Parameters
Type Name Description
Nullable<String> path

The path of the directory where the storage files will be saved. If the path is null, the database is created in memory.

Methods

| 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

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

Dispose()

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(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<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 keys. Non-existent keys are omitted (rather than being filled with null).

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

| 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(IDictionary<KeyBytes, Byte[]>)

Declaration
public void Set(IDictionary<KeyBytes, byte[]> values)
Parameters
Type Name Description
IDictionary<KeyBytes, Byte[]> values
| 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.

Implements

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