tree

package
v0.0.0-...-2c4dd60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MergeTypeKeypath = state.Keypath("Merge-Type")
	ValidatorKeypath = state.Keypath("Validator")
)
View Source
var (
	ErrNoParentYet          = errors.New("no parent yet")
	ErrPendingParent        = errors.New("parent pending validation")
	ErrInvalidParent        = errors.New("invalid parent")
	ErrInvalidSignature     = errors.New("invalid signature")
	ErrInvalidTx            = errors.New("invalid tx")
	ErrTxMissingParents     = errors.New("tx must have parents")
	ErrMissingCriticalBlobs = errors.New("missing critical blobs")
	ErrSenderIsNotAMember   = errors.New("tx sender is not a member of state URI")
)
View Source
var (
	GenesisTxID = state.VersionFromString("genesis")
	EmptyHash   = types.Hash{}
)
View Source
var (
	TxStatusUnknown   = pb.TxStatusUnknown
	TxStatusInMempool = pb.TxStatusInMempool
	TxStatusInvalid   = pb.TxStatusInvalid
	TxStatusValid     = pb.TxStatusValid
)

Functions

func NewAllTxsIterator

func NewAllTxsIterator(txStore TxStore, stateURI string, txIDs []state.Version) *allTxsForStateURIIterator

func NewAllValidTxsForStateURIOrderedIterator

func NewAllValidTxsForStateURIOrderedIterator(
	txStore TxStore,
	stateURI string,
	fromTxID state.Version,
) *allValidTxsForStateURIOrderedIterator

func NewMempool

func NewMempool(processCallback func(tx Tx) processTxOutcome) *mempool

Types

type Controller

type Controller interface {
	process.Interface

	AddTx(tx Tx) error
	StateAtVersion(version *state.Version) state.Node
	// QueryIndex(version *state.Version, keypath state.Keypath, indexName state.Keypath, queryParam state.Keypath, rng *state.Range) (state.Node, error)
	Leaves() ([]state.Version, error)
	OnNewState(fn NewStateCallback)
	DebugPrint()
}

func NewController

func NewController(
	stateURI string,
	stateDBRootPath string,
	badgerOpts badgerutils.OptsBuilder,
	controllerHub ControllerHub,
	txStore TxStore,
	blobStore blob.Store,
) (Controller, error)

type ControllerHub

type ControllerHub interface {
	process.Interface

	AddTx(tx Tx) error
	FetchTx(stateURI string, txID state.Version) (Tx, error)
	FetchValidTxsOrdered(stateURI string, fromTxID state.Version) TxIterator

	StateURIsWithData() (types.Set[string], error)
	IsStateURIWithData(stateURI string) (bool, error)
	OnNewStateURIWithData(fn NewStateURIWithDataCallback)
	StateAtVersion(stateURI string, version *state.Version) (state.Node, error)
	// QueryIndex(stateURI string, version *state.Version, keypath state.Keypath, indexName state.Keypath, queryParam state.Keypath, rng *state.Range) (state.Node, error)
	Leaves(stateURI string) ([]state.Version, error)

	BlobReader(refID blob.ID, rng *types.Range) (io.ReadCloser, int64, error)

	OnNewState(fn NewStateCallback)
	DebugPrint(stateURI string)
}

func NewControllerHub

func NewControllerHub(dbRootPath string, txStore TxStore, blobStore blob.Store, badgerOpts badgerutils.OptsBuilder) ControllerHub

type Indexer

type Indexer interface {
	IndexNode(relKeypath state.Keypath, node state.Node) (state.Keypath, state.Node, error)
}

type IndexerConstructor

type IndexerConstructor func(config state.Node) (Indexer, error)

type Mempool

type Mempool interface {
	process.Interface
	Add(tx Tx)
	Get() *txSortedSet
	ForceReprocess()
}

type NewStateCallback

type NewStateCallback func(tx Tx, state state.Node, leaves []state.Version, diff *state.Diff)

type NewStateURIWithDataCallback

type NewStateURIWithDataCallback func(stateURI string)

type Patch

type Patch = pb.Patch

type Resolver

type Resolver interface {
	ResolveState(node state.Node, blobStore blob.Store, sender types.Address, txID state.Version, parents []state.Version, patches []Patch) error
	InternalState() map[string]interface{}
}

func NewDumbResolver

func NewDumbResolver(config state.Node, internalState map[string]interface{}) (Resolver, error)

func NewJSResolver

func NewJSResolver(config state.Node, internalState map[string]interface{}) (_ Resolver, err error)

func NewLuaResolver

func NewLuaResolver(config state.Node, internalState map[string]interface{}) (Resolver, error)

type ResolverConstructor

type ResolverConstructor func(config state.Node, internalState map[string]interface{}) (Resolver, error)

type StateURI

type StateURI string

func (StateURI) MapKey

func (s StateURI) MapKey() (state.Keypath, error)

func (*StateURI) ScanMapKey

func (s *StateURI) ScanMapKey(keypath state.Keypath) error

type Tx

type Tx = pb.Tx

type TxIterator

type TxIterator interface {
	Rewind()
	Valid() bool
	Next()
	Tx() *Tx
	Err() error
}

type TxStatus

type TxStatus = pb.TxStatus

type TxStore

type TxStore interface {
	Start() error
	Close()

	AddTx(tx Tx) error
	RemoveTx(stateURI string, txID state.Version) error
	TxExists(stateURI string, txID state.Version) (bool, error)
	FetchTx(stateURI string, txID state.Version) (Tx, error)
	AllTxsForStateURI(stateURI string, fromTxID state.Version) (TxIterator, error)
	AllValidTxsForStateURIOrdered(stateURI string, fromTxID state.Version) TxIterator
	IsStateURIWithData(stateURI string) (bool, error)
	StateURIsWithData() (types.Set[string], error)
	OnNewStateURIWithData(fn NewStateURIWithDataCallback)
	MarkLeaf(stateURI string, txID state.Version) error
	UnmarkLeaf(stateURI string, txID state.Version) error
	Leaves(stateURI string) ([]state.Version, error)

	DebugPrint()
}

func NewBadgerTxStore

func NewBadgerTxStore(badgerOpts badger.Options) TxStore

type Validator

type Validator interface {
	ValidateTx(node state.Node, tx *Tx) error
}

func NewPermissionsValidator

func NewPermissionsValidator(config state.Node) (Validator, error)

type ValidatorConstructor

type ValidatorConstructor func(config state.Node) (Validator, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL