Class TrieStateStore
An IStateStore implementation. It stores states with MerkleTrie.
Inherited Members
Namespace: Libplanet.Store
Assembly: Libplanet.Store.dll
Syntax
public class TrieStateStore : IStateStore, IDisposable
Constructors
| Improve this Doc View SourceTrieStateStore(IKeyValueStore, Boolean)
Creates a new TrieStateStore.
Declaration
public TrieStateStore(IKeyValueStore stateKeyValueStore, bool secure = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IKeyValueStore | stateKeyValueStore | The storage to store states. It used by MerkleTrie in internal. |
| Boolean | secure | Whether to use MerkleTrie in secure mode. MerkleTrie(IKeyValueStore, INode, Boolean). |
Properties
| Improve this Doc View SourceSecure
true if the MerkleTrie is in secure mode. In secure mode, keys are hashed under the hood.
Declaration
public bool Secure { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
StateKeyValueStore
An IStateStore implementation. It stores states with MerkleTrie.
Declaration
public IKeyValueStore StateKeyValueStore { get; }
Property Value
| Type | Description |
|---|---|
| IKeyValueStore |
Methods
| Improve this Doc View SourceCopyStates(IImmutableSet<HashDigest<SHA256>>, TrieStateStore)
Copies states under state root hashes of given stateRootHashes
to targetStateStore.
Declaration
public void CopyStates(IImmutableSet<HashDigest<SHA256>> stateRootHashes, TrieStateStore targetStateStore)
Parameters
| Type | Name | Description |
|---|---|---|
| IImmutableSet<HashDigest<SHA256>> | stateRootHashes | The state root hashes of states to copy. |
| TrieStateStore | targetStateStore | The target state store to copy state root hashes. |
Dispose()
An IStateStore implementation. It stores states with MerkleTrie.
Declaration
public void Dispose()
GetStateRoot(Nullable<HashDigest<SHA256>>)
Gets the state root trie of the stateRootHash from the state store.
Declaration
public ITrie GetStateRoot(HashDigest<SHA256>? stateRootHash)
Parameters
| Type | Name | Description |
|---|---|---|
| Nullable<HashDigest<SHA256>> | stateRootHash | The state root hash of the state root trie to get. If null is passed the empty state root trie is returned. |
Returns
| Type | Description |
|---|---|
| ITrie | The state root trie of the |
PruneStates(IImmutableSet<HashDigest<SHA256>>)
Prunes the states no more used from the state store.
Declaration
public void PruneStates(IImmutableSet<HashDigest<SHA256>> survivingStateRootHashes)
Parameters
| Type | Name | Description |
|---|---|---|
| IImmutableSet<HashDigest<SHA256>> | survivingStateRootHashes | The state root hashes not to prune. These state root hashes are guaranteed to survive after pruning. |