Show / Hide Table of Contents

Interface IStateStore

An interface to store states.

Namespace: Libplanet.Store
Assembly: Libplanet.dll
Syntax
public interface IStateStore

Methods

| Improve this Doc View Source

ContainsBlockStates(HashDigest<SHA256>)

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

Declaration
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

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

Copies metadata related to states from sourceChainId to destinationChainId, with branchpoint.

Declaration
void ForkStates<T>(Guid sourceChainId, Guid destinationChainId, Block<T> branchpoint)
    where T : IAction, new()
Parameters
Type Name Description
Guid sourceChainId

The Id of the chain which copies from.

Guid destinationChainId

The Id of the chain which copies to.

Block<T> branchpoint

The branchpoint to begin coping.

Type Parameters
Name Description
T

An IAction type. It should match to branchpoint's type parameter.

| Improve this Doc View Source

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

Gets state queried by stateKey in the point, blockHash.

Declaration
IValue GetState(string stateKey, HashDigest<SHA256>? blockHash = null, Guid? chainId = null)
Parameters
Type Name Description
String stateKey

The key to query state.

Nullable<HashDigest<SHA256>> blockHash

The Hash which the point to query by stateKey at.

Nullable<Guid> chainId

The Id of wanted got.

Returns
Type Description
IValue

The state queried from blockHash and stateKey. If it couldn't find state, returns null.

| Improve this Doc View Source

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

Sets states mapped as relation Hash → states. It guarantees GetState(String, Nullable<HashDigest<SHA256>>, Nullable<Guid>) will return the same state if you passed same block unless it has overwritten.

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

The Block<T> to set states.

IImmutableDictionary<String, IValue> states

The dictionary of state keys to states.

Type Parameters
Name Description
T

An IAction type. It should match to block's type parameter.

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