base

package
v0.2.4-0...-f8342f3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 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

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

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

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

type Step

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

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

type WithHost

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

type WithHostPriv

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

Jump to

Keyboard shortcuts

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