Documentation ¶
Index ¶
- Constants
- func LoadBlockBytes(store kvstore.KVStore, stateIndex uint32) ([]byte, error)
- func NewStateUpdate(timestamp ...time.Time) *stateUpdateImpl
- func OriginStateHash() hashing.HashValue
- type Block
- type OptimisticStateReader
- type OptimisticStateReaderImpl
- func (r *OptimisticStateReaderImpl) BlockIndex() (uint32, error)
- func (r *OptimisticStateReaderImpl) Hash() (hashing.HashValue, error)
- func (r *OptimisticStateReaderImpl) KVStoreReader() kv.KVStoreReader
- func (r *OptimisticStateReaderImpl) SetBaseline()
- func (r *OptimisticStateReaderImpl) Timestamp() (time.Time, error)
- type StateUpdate
- type VirtualStateAccess
- func CreateOriginState(store kvstore.KVStore, chainID *iscp.ChainID) (VirtualStateAccess, error)
- func LoadSolidState(store kvstore.KVStore, chainID *iscp.ChainID) (VirtualStateAccess, bool, error)
- func WrapMustOptimisticVirtualStateAccess(state VirtualStateAccess, baseline coreutil.StateBaseline) VirtualStateAccess
Constants ¶
const OriginStateHashBase58 = "96yCdioNdifMb8xTeHQVQ8BzDnXDbRBoYzTq7iVaymvV"
Variables ¶
This section is empty.
Functions ¶
func LoadBlockBytes ¶ added in v0.2.0
LoadBlockBytes loads block bytes of the specified block index from DB
func NewStateUpdate ¶
NewStateUpdate creates a state update with timestamp mutation, if provided
func OriginStateHash ¶ added in v0.2.0
Types ¶
type Block ¶ added in v0.1.0
type Block interface { BlockIndex() uint32 ApprovingOutputID() ledgerstate.OutputID SetApprovingOutputID(ledgerstate.OutputID) Timestamp() time.Time PreviousStateHash() hashing.HashValue EssenceBytes() []byte // except state transaction id Bytes() []byte }
Block is a sequence of state updates applicable to the virtual state
func BlockFromBytes ¶ added in v0.2.0
type OptimisticStateReader ¶ added in v0.2.0
type OptimisticStateReaderImpl ¶ added in v0.2.0
type OptimisticStateReaderImpl struct {
// contains filtered or unexported fields
}
state reader reads the chain state from db and validates it
func NewOptimisticStateReader ¶ added in v0.2.0
func NewOptimisticStateReader(db kvstore.KVStore, glb coreutil.ChainStateSync) *OptimisticStateReaderImpl
NewOptimisticStateReader creates new optimistic read-only access to the database. It contains own read baseline
func (*OptimisticStateReaderImpl) BlockIndex ¶ added in v0.2.0
func (r *OptimisticStateReaderImpl) BlockIndex() (uint32, error)
func (*OptimisticStateReaderImpl) Hash ¶ added in v0.2.0
func (r *OptimisticStateReaderImpl) Hash() (hashing.HashValue, error)
func (*OptimisticStateReaderImpl) KVStoreReader ¶ added in v0.2.0
func (r *OptimisticStateReaderImpl) KVStoreReader() kv.KVStoreReader
func (*OptimisticStateReaderImpl) SetBaseline ¶ added in v0.2.0
func (r *OptimisticStateReaderImpl) SetBaseline()
type StateUpdate ¶
type StateUpdate interface { Mutations() *buffered.Mutations Clone() StateUpdate Bytes() []byte String() string }
StateUpdate is a set of mutations
func NewStateUpdateWithBlocklogValues ¶ added in v0.2.0
type VirtualStateAccess ¶ added in v0.2.0
type VirtualStateAccess interface { BlockIndex() uint32 Timestamp() time.Time PreviousStateHash() hashing.HashValue StateCommitment() hashing.HashValue KVStoreReader() kv.KVStoreReader ApplyStateUpdates(...StateUpdate) ApplyBlock(Block) error ExtractBlock() (Block, error) Commit(blocks ...Block) error KVStore() *buffered.BufferedKVStoreAccess Copy() VirtualStateAccess DangerouslyConvertToString() string }
VirtualStateAccess is a virtualized access interface to the chain's database It consists of state reader and the buffer to collect mutations to key values
func CreateOriginState ¶ added in v0.2.0
CreateOriginState creates zero state which is the minimal consistent state. It is not committed it is an origin state. It has statically known hash coreutils.OriginStateHashBase58
func LoadSolidState ¶
LoadSolidState establishes VirtualStateAccess interface with the solid state in DB. Checks consistency of DB
func WrapMustOptimisticVirtualStateAccess ¶ added in v0.2.0
func WrapMustOptimisticVirtualStateAccess(state VirtualStateAccess, baseline coreutil.StateBaseline) VirtualStateAccess
WrapMustOptimisticVirtualStateAccess wraps virtual state with state baseline in on object Does not copy buffers