Namespace Libplanet.Store
Classes
BaseStore
Common code for several IStore implementations.
BlockSet
DataModel
A class
representing an abstract data model that can be easily
encoded and decoded to and from a
Inheriting this class and simply declaring properties allows an instance of the child class
to encode its data into a
However, there are certain restrictions that apply when using this class
:
-
The complete list of allowed property types are as follows:
-
Primitive types:
bool
,int
,long
,BigInteger
,ImmutableArray<byte>
,Guid
,Address
, andstring
. - Special types: Any type inherited from DataModel.
-
Collective types:
-
where T
is a primitive type. -
where -
TKey
is one ofImmutableArray<byte>
,Address
,Guid
, andstring
. -
TValue
is a primitive type.
-
-
-
Primitive types:
-
Value types are not allowed to be declared as
nullable
, not even as a generic type parameter. That is, types such asbool?
,Address?
, andImmutableList<int?>
are not allowed. -
Reference types are not allowed to be assigned null. This will
result in an
when Encode() is called. -
Trying to assign null to any property or to a part of
a collection will result in an
when DataModel(Bencodex.Types.Dictionary) is called.
DefaultStore
The default built-in IStore implementation. This stores data in the file system or in memory. It also uses LiteDB for some complex indices.
DefaultStore and DefaultKeyValueStore-backed
TrieStateStore can be instantiated from a URI with default+file:
scheme
using LoadStore(Uri), e.g.:
default+file:///var/data/planet/
default+file:///c:/Users/john/AppData/Local/planet/
The following query string parameters are supported:
journal | true (default) or false. Corresponds to
DefaultStore(String, Boolean, Int32, Int32, Int32, Int32, Boolean, Boolean)'s journal
parameter. |
index-cache | Corresponds to
DefaultStore(String, Boolean, Int32, Int32, Int32, Int32, Boolean, Boolean)'s
indexCacheSize parameter. 50000 by default. |
block-cache | Corresponds to
DefaultStore(String, Boolean, Int32, Int32, Int32, Int32, Boolean, Boolean)'s
blockCacheSize parameter. 512 by default. |
tx-cache | Corresponds to
DefaultStore(String, Boolean, Int32, Int32, Int32, Int32, Boolean, Boolean)'s
txCacheSize parameter. 1024 by default. |
flush | true (default) or false. Corresponds to
DefaultStore(String, Boolean, Int32, Int32, Int32, Int32, Boolean, Boolean)'s flush
parameter. |
readonly | true or false (default). Corresponds to
DefaultStore(String, Boolean, Int32, Int32, Int32, Int32, Boolean, Boolean)'s readOnly
parameter. |
states-dir | Corresponds to path
parameter. It is relative to the URI path, and defaults to states . |
HashNodeCache
A class used for internally caching hashed nodes of MerkleTries.
MemoryStore
Volatile in-memory store.
It is useful for storing temporal small chains, e.g., fixtures for unit tests of game logic.
MemoryStore and MemoryKeyValueStore-backed
TrieStateStore can be instantiated from a URI with memory:
scheme
using LoadStore(Uri), e.g.:
memory:
StoreExtensions
Convenient extension methods for IStore.
StoreLoaderAttribute
Registers a static method as a store loader. The method must comply with StoreLoader delegate.
TrieStateStore
An IStateStore implementation. It stores states with MerkleTrie.
Structs
BlockDigest
Class that store uses to save blocks. This contains: BlockHeader, and list of TxIds.
Interfaces
IStateStore
An interface to store states.
IStore
Delegates
StoreLoader
A function that parses a URI and returns a pair of IStore and IStateStore.