common

package
v0.2200.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CfgClientPort configures the worker client port.
	CfgClientPort = "worker.client.port"

	// CfgSentryAddresses configures addresses and public keys of sentry nodes the worker should
	// connect to.
	CfgSentryAddresses = "worker.sentry.address"

	// Flags has the configuration flags.
	Flags = flag.NewFlagSet("", flag.ContinueOnError)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	ClientPort      uint16
	ClientAddresses []node.Address
	SentryAddresses []node.TLSAddress

	TxPool txpool.Config
	// contains filtered or unexported fields
}

Config contains common worker config.

func NewConfig

func NewConfig() (*Config, error)

NewConfig creates a new worker config.

func (*Config) GetNodeAddresses

func (c *Config) GetNodeAddresses() ([]node.Address, error)

GetNodeAddresses returns worker node addresses.

type Worker

type Worker struct {
	HostNode          control.ControlledNode
	DataDir           string
	Identity          *identity.Identity
	Consensus         consensus.Backend
	Grpc              *grpc.Server
	GrpcPolicyWatcher policyAPI.PolicyWatcher
	P2P               *p2p.P2P
	IAS               ias.Endpoint
	KeyManager        keymanagerApi.Backend
	RuntimeRegistry   runtimeRegistry.Registry
	GenesisDoc        *genesis.Document
	// contains filtered or unexported fields
}

Worker is a garbage bag with lower level services and common runtime objects.

func New

func New(
	hostNode control.ControlledNode,
	dataDir string,
	identity *identity.Identity,
	consensus consensus.Backend,
	p2p *p2p.P2P,
	ias ias.Endpoint,
	keyManager keymanagerApi.Backend,
	runtimeRegistry runtimeRegistry.Registry,
	genesisDoc *genesis.Document,
) (*Worker, error)

New creates a new worker.

func (*Worker) Cleanup

func (w *Worker) Cleanup()

Cleanup performs the service specific post-termination cleanup.

func (*Worker) Enabled

func (w *Worker) Enabled() bool

Enabled returns if worker is enabled.

func (*Worker) GetConfig

func (w *Worker) GetConfig() Config

GetConfig returns the worker's configuration.

func (*Worker) GetRuntime

func (w *Worker) GetRuntime(id common.Namespace) *committee.Node

GetRuntime returns a common committee node for the given runtime (if available).

In case the runtime with the specified id was not configured for this node it returns nil.

func (*Worker) GetRuntimes

func (w *Worker) GetRuntimes() map[common.Namespace]*committee.Node

GetRuntimes returns a map of configured runtimes.

func (*Worker) Initialized

func (w *Worker) Initialized() <-chan struct{}

Initialized returns a channel that will be closed when the transaction scheduler is initialized and ready to service requests.

func (*Worker) Name

func (w *Worker) Name() string

Name returns the service name.

func (*Worker) Quit

func (w *Worker) Quit() <-chan struct{}

Quit returns a channel that will be closed when the service terminates.

func (*Worker) Start

func (w *Worker) Start() error

Start starts the service.

func (*Worker) Stop

func (w *Worker) Stop()

Stop halts the service.

Directories

Path Synopsis
p2p
Package p2p implements the worker committee gossip network.
Package p2p implements the worker committee gossip network.
error
Package error exists only to break an import loop.
Package error exists only to break an import loop.
rpc
Package rpc provides tools for building simple RPC protocols via libp2p.
Package rpc provides tools for building simple RPC protocols via libp2p.

Jump to

Keyboard shortcuts

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