Show / Hide Table of Contents

Interface ITrie

An interface for Merkle Tree.

Namespace: Libplanet.Store.Trie
Assembly: Libplanet.dll
Syntax
public interface ITrie

Properties

| Improve this Doc View Source

Hash

The state root hash of the trie.

Declaration
HashDigest<SHA256> Hash { get; }
Property Value
Type Description
HashDigest<SHA256>
| Improve this Doc View Source

Recorded

Whether the trie root is recorded in the store.

Declaration
bool Recorded { get; }
Property Value
Type Description
Boolean
Remarks

Empty root is considered as recorded.

Methods

| Improve this Doc View Source

Commit(Boolean)

Cleans up and stores the ITrie in storage.

Declaration
ITrie Commit(bool rehearsal = false)
Parameters
Type Name Description
Boolean rehearsal

Whether to store nodes.

Returns
Type Description
ITrie

Returns new committed ITrie.

| Improve this Doc View Source

Set(Byte[], IValue)

Stores the value to the node corresponding to given key.

Declaration
ITrie Set(byte[] key, IValue value)
Parameters
Type Name Description
Byte[] key

An index to look with TryGet(Byte[], out Nullable<IValue>) after.

IValue value

The value to store.

Returns
Type Description
ITrie

Returns new updated ITrie.

| Improve this Doc View Source

TryGet(Byte[], out Nullable<IValue>)

Gets the value stored with key in Set(Byte[], IValue).

Declaration
bool TryGet(byte[] key, out IValue? value)
Parameters
Type Name Description
Byte[] key

The key used in Set(Byte[], IValue) to store a value.

Nullable<IValue> value

The reference pointer to be set the value stored.

Returns
Type Description
Boolean

If there is a value corresponded to key, set value to it and return true. If not, set value to null and return false.

See Also

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