common

package
v0.2102.8 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 21 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

	StorageCommitTimeout time.Duration
	// 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,
	enabled bool,
	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) NewUnmanagedCommitteeNode

func (w *Worker) NewUnmanagedCommitteeNode(runtime runtimeRegistry.Runtime, enableP2P bool) (*committee.Node, error)

NewUnmanagedCommitteeNode creates a new common committee node that is not managed by this worker.

Since the node is unmanaged the caller needs to ensure that the node will be properly terminated once started.

Note that this does not instruct the storage backend to watch the given runtime.

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.

Jump to

Keyboard shortcuts

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