Interface IStateStore
An interface to store states.
Namespace: Libplanet.Store
Assembly: Libplanet.dll
Syntax
public interface IStateStore
Methods
| Improve this Doc View SourceContainsBlockStates(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 |
Returns
| Type | Description |
|---|---|
| Boolean | Whether it contains the block states corresponded to
|
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
|
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
|
| Nullable<Guid> | chainId | The Id of wanted got. |
Returns
| Type | Description |
|---|---|
| IValue | The state queried from |
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
|