Namespace Libplanet.Store
Classes
BaseIndex<TKey, TVal>
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 Bencodex.
Inheriting this class and simply declaring properties allows an instance of the child class
to encode its data into a Bencodex.
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 Data
Model . -
Collective types:
-
Immutable
List<T> whereT
is a primitive type. -
Immutable
Dictionary<TKey,TValue> where-
TKey
is one ofImmutableArray<byte>
,Address
,Guid
, andstring
. -
TValue
is a primitive type.
-
-
Immutable
-
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 Exception when Encode() is called.
-
Trying to assign null to any property or to a part of
a collection will result in an Exception when
Data
Model(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.
Defaultdefault+file:
scheme
using Load
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
Defaultjournal
parameter. |
index-cache | Corresponds to DefaultindexCacheSize parameter. 50000 by default. |
block-cache | Corresponds to DefaultblockCacheSize parameter. 512 by default. |
tx-cache | Corresponds to DefaulttxCacheSize parameter. 1024 by default. |
flush | true (default) or false. Corresponds to
Defaultflush
parameter. |
readonly | true or false (default). Corresponds to
DefaultreadOnly
parameter. |
states-dir | Corresponds to Defaultpath
parameter. It is relative to the URI path, and defaults to states . |
MemoryStore
Volatile in-memory store.
It is useful for storing temporal small chains, e.g., fixtures for unit tests of game logic.
Memorymemory:
scheme
using Load
memory:
StoreExtensions
Convenient extension methods for IStore.
StoreLoaderAttribute
Registers a static method as a store loader. The method must comply with
Store
TrieStateStore
An IState
Structs
BlockDigest
Class that store uses to save blocks. This contains:
Block
Interfaces
IStateStore
An interface to store states.
IStore
Delegates
StoreLoader
A function that parses a URI and returns a pair of IStore and
IState