Class StateStoreExtensions
Convenient extension methods for IStateStore.
Inherited Members
Namespace: Libplanet.Store
Assembly: Libplanet.Store.dll
Syntax
public static class StateStoreExtensions
Methods
| Improve this Doc View SourceCommit(IStateStore, Nullable<HashDigest<SHA256>>, IImmutableDictionary<KeyBytes, IValue>)
Records rawStatesDelta which is based on the previous state
root, and returns the new state root.
Declaration
public static ITrie Commit(this IStateStore stateStore, HashDigest<SHA256>? previousStateRootHash, IImmutableDictionary<KeyBytes, IValue> rawStatesDelta)
Parameters
| Type | Name | Description |
|---|---|---|
| IStateStore | stateStore | The IStateStore to records
the |
| Nullable<HashDigest<SHA256>> | previousStateRootHash | The state root hash on which
the |
| IImmutableDictionary<KeyBytes, Bencodex.Types.IValue> | rawStatesDelta | The raw states delta to be recorded. |
Returns
| Type | Description |
|---|---|
| ITrie | The new state root. |
ContainsStateRoot(IStateStore, HashDigest<SHA256>)
Checks if the state root is recorded in the stateStore.
Declaration
public static bool ContainsStateRoot(this IStateStore stateStore, HashDigest<SHA256> stateRootHash)
Parameters
| Type | Name | Description |
|---|---|---|
| IStateStore | stateStore | The IStateStore to check if the state root is recorded in it. |
| HashDigest<SHA256> | stateRootHash | The hash of the state root to check if it is recorded. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the state root exists in the
|
GetStates(IStateStore, Nullable<HashDigest<SHA256>>, IReadOnlyList<KeyBytes>)
Gets multiple states at once.
Declaration
public static IReadOnlyList<IValue> GetStates(this IStateStore stateStore, HashDigest<SHA256>? stateRootHash, IReadOnlyList<KeyBytes> rawStateKeys)
Parameters
| Type | Name | Description |
|---|---|---|
| IStateStore | stateStore | The IStateStore to get states. |
| Nullable<HashDigest<SHA256>> | stateRootHash | The root hash of the state trie to look up states from. |
| IReadOnlyList<KeyBytes> | rawStateKeys | State keys to get. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<Bencodex.Types.IValue> | The state values associated to the specified |