base

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	WithHost
	// Shared between actors
	GlobalContext context.Context
	// For actor
	ActorContext context.Context
	// Control the execution of a call
	Control Control
	// For command
	Log logrus.FieldLogger
	// Optional std output
	Out io.Writer
}

type Control added in v0.2.1

type Control interface {
	// RegisterStop register a callback for the controller to shutdown a background task of a command
	// The command can be running the background task in some other go routine after returning.
	RegisterStop(onStop OnStop)

	// Step creates a job that can be stepped into by the controller.
	// It blocks until the step is consumed. The step itself can schedule next steps
	Step(step Step) error
}

type OnStop added in v0.2.1

type OnStop func(ctx context.Context) error

OnStop is a function that is proposed by the command, and called by the controller to end the command. The context is used to limit the stop execution

type PrivSettings added in v0.2.1

type PrivSettings interface {
	// GetPriv, may be nil
	GetPriv() *crypto.Secp256k1PrivateKey
	SetPriv(p *crypto.Secp256k1PrivateKey) error
}

type Step added in v0.2.1

type Step func(ctx context.Context) error

Step is a function that is proposed by the command, and can be stepped into by the controller. The context is used to limit the step execution

type WithEnrNode added in v0.2.1

type WithEnrNode interface {
	GetNode() (n *enode.Node, ok bool)
}

type WithHost

type WithHost interface {
	Host() (h host.Host, err error)
}

type WithHostPriv added in v0.2.1

type WithHostPriv interface {
	GetHostPriv() *crypto.Secp256k1PrivateKey
}

Jump to

Keyboard shortcuts

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