Class StateStoreExtensions
Convenient extension methods for IStateStore.
Inherited Members
Namespace: Libplanet.Store
Assembly: Libplanet.dll
Syntax
public static class StateStoreExtensions
Methods
| Improve this Doc View SourceCommit(IStateStore, Nullable<HashDigest<SHA256>>, IImmutableDictionary<String, IValue>, Boolean)
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<string, IValue> rawStatesDelta, bool rehearsal = false)
Parameters
Type | Name | Description |
---|---|---|
IStateStore | stateStore | The IStateStore to records
the |
Nullable<HashDigest<SHA256>> | previousStateRootHash | The state root hash on which
the |
IImmutableDictionary<String, IValue> | rawStatesDelta | The raw states delta to be recorded. |
Boolean | rehearsal | If turned on, the |
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 |
|
GetState(IStateStore, String, Nullable<HashDigest<SHA256>>)
Gets the state of the rawStateKey
from
the stateRootHash
.
Declaration
public static IValue? GetState(this IStateStore stateStore, string rawStateKey, HashDigest<SHA256>? stateRootHash)
Parameters
Type | Name | Description |
---|---|---|
IStateStore | stateStore | The IStateStore to get the state. |
String | rawStateKey | The key of the state to get. |
Nullable<HashDigest<SHA256>> | stateRootHash | The state root hash to get the state. |
Returns
Type | Description |
---|---|
Nullable<IValue> | The state of the |