Show / Hide Table of Contents

Class StateStoreExtensions

Convenient extension methods for IStateStore.

Inheritance
Object
StateStoreExtensions
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Libplanet.Store
Assembly: Libplanet.Store.dll
Syntax
public static class StateStoreExtensions

Methods

| Improve this Doc View Source

Commit(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 rawStatesDelta.

Nullable<HashDigest<SHA256>> previousStateRootHash

The state root hash on which the rawStatesDelta is based.

IImmutableDictionary<KeyBytes, Bencodex.Types.IValue> rawStatesDelta

The raw states delta to be recorded.

Returns
Type Description
ITrie

The new state root.

| Improve this Doc View Source

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 stateStore; otherwise, false.

| Improve this Doc View Source

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 rawStateKeys. The associated values are ordered in the same way to the corresponding rawStateKeys. Absent values are represented as null.

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