Show / Hide Table of Contents

Class TrieStateStore

An IStateStore implementation. It stores states with MerkleTrie.

Inheritance
Object
TrieStateStore
Implements
IStateStore
IDisposable
Namespace: Libplanet.Store
Assembly: Libplanet.dll
Syntax
public class TrieStateStore : object, IStateStore, IDisposable

Constructors

| Improve this Doc View Source

TrieStateStore(IKeyValueStore, IKeyValueStore, Boolean)

Creates a new TrieStateStore.

Declaration
public TrieStateStore(IKeyValueStore stateKeyValueStore, IKeyValueStore stateHashKeyValueStore, bool secure = false)
Parameters
Type Name Description
IKeyValueStore stateKeyValueStore

The storage to store states. It used by MerkleTrie in internal.

IKeyValueStore stateHashKeyValueStore

The storage to store state hash corresponding to block hash.

Boolean secure

Whether to use MerkleTrie in secure mode. Libplanet.Store.Trie.MerkleTrie.#ctor(Libplanet.Store.Trie.IKeyValueStore,Libplanet.Store.Trie.Nodes.INode,System.Boolean).

Methods

| Improve this Doc View Source

ContainsBlockStates(HashDigest<SHA256>)

Checks if the states corresponded to the block derived from blockHash exist.

Declaration
public bool ContainsBlockStates(HashDigest<SHA256> blockHash)
Parameters
Type Name Description
HashDigest<SHA256> blockHash

The Hash of Block<T>.

Returns
Type Description
Boolean

Whether it contains the block states corresponded to blockHash.

| Improve this Doc View Source

Dispose()

Declaration
public void Dispose()
| Improve this Doc View Source

ForkStates<T>(Guid, Guid, Block<T>)

Declaration
public void ForkStates<T>(Guid sourceChainId, Guid destinationChainId, Block<T> branchpoint)
    where T : IAction, new()
Parameters
Type Name Description
Guid sourceChainId
Guid destinationChainId
Block<T> branchpoint
Type Parameters
Name Description
T
| Improve this Doc View Source

GetRootHash(HashDigest<SHA256>)

Gets the state hash corresponds to blockHash.

Declaration
public HashDigest<SHA256> GetRootHash(HashDigest<SHA256> blockHash)
Parameters
Type Name Description
HashDigest<SHA256> blockHash

The Hash to get state hash.

Returns
Type Description
HashDigest<SHA256>

If there is a state hash corresponds to blockHash, it will return the state hash. If not, it will return null.

| Improve this Doc View Source

GetState(String, Nullable<HashDigest<SHA256>>, Nullable<Guid>)

Declaration
public IValue? GetState(string stateKey, HashDigest<SHA256>? blockHash = null, Guid? chainId = null)
Parameters
Type Name Description
String stateKey
Nullable<HashDigest<SHA256>> blockHash
Nullable<Guid> chainId
Returns
Type Description
Nullable<IValue>
| Improve this Doc View Source

PruneStates(ImmutableHashSet<HashDigest<SHA256>>)

Declaration
public void PruneStates(ImmutableHashSet<HashDigest<SHA256>> excludeBlockHashes)
Parameters
Type Name Description
ImmutableHashSet<HashDigest<SHA256>> excludeBlockHashes
| Improve this Doc View Source

SetStates<T>(Block<T>, IImmutableDictionary<String, IValue>)

Declaration
public void SetStates<T>(Block<T> block, IImmutableDictionary<string, IValue> states)
    where T : IAction, new()
Parameters
Type Name Description
Block<T> block
IImmutableDictionary<String, IValue> states
Type Parameters
Name Description
T

Implements

IStateStore
IDisposable
  • Improve this Doc
  • View Source
Back to top Copyright © 2019–2020 Planetarium