core

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain interface {
	Start() error // Start chain
	SetRouter(*Router)
	Id() msg.ChainId
	Name() string
	LatestBlock() metrics.LatestBlock
	Stop()
}

type ChainConfig

type ChainConfig struct {
	Name           string            // Human-readable chain name
	Id             msg.ChainId       // ChainID
	Endpoint       string            // url for rpc endpoint
	From           string            // address of key to use
	KeystorePath   string            // Location of key files
	Insecure       bool              // Indicated whether the test keyring should be used
	BlockstorePath string            // Location of blockstore
	FreshStart     bool              // If true, blockstore is ignored at start.
	LatestBlock    bool              // If true, overrides blockstore or latest block in config and starts from current block
	Opts           map[string]string // Per chain options
}

type Core

type Core struct {
	Registry []Chain
	// contains filtered or unexported fields
}

func NewCore

func NewCore(sysErr <-chan error) *Core

func (*Core) AddChain

func (c *Core) AddChain(chain Chain)

AddChain registers the chain in the Registry and calls Chain.SetRouter()

func (*Core) Errors

func (c *Core) Errors() <-chan error

func (*Core) SetRouter

func (c *Core) SetRouter(chain Chain)

func (*Core) Start

func (c *Core) Start()

Start will call all registered chains' Start methods and block forever (or until signal is received)

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router forwards messages from their source to their destination

func NewRouter

func NewRouter(log log.Logger) *Router

func (*Router) Listen

func (r *Router) Listen(id msg.ChainId, w Writer)

Listen registers a Writer with a ChainId which Router.Send can then use to propagate messages

func (*Router) Send

func (r *Router) Send(msg msg.Message) error

Send passes a message to the destination Writer if it exists

type Writer

type Writer interface {
	ResolveMessage(message msg.Message) bool
}

Writer consumes a message and makes the requried on-chain interactions.

Jump to

Keyboard shortcuts

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