backend

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyConfig

func CopyConfig(config map[string]interface{}) map[string]interface{}

Types

type ExecutorRegistry

type ExecutorRegistry interface {
	RegisterExecutor(name string, executor string) error
	GetExecutor(name string) (string, bool)
}

func NewEmptyExecutorRegistry

func NewEmptyExecutorRegistry() ExecutorRegistry

func NewExecutorRegistry

func NewExecutorRegistry(registry map[string]string) ExecutorRegistry

type Network

type Network interface {
	// GetNodes returns the names of each node in the network
	GetNodes() []Node
	// GetNode returns the Node corresponding to [name]
	GetNode(name string) (Node, bool)
	// AddNode adds new node to the network
	AddNode(ctx context.Context, config NodeConfig) (Node, error)
	// Teardown stops the network and additionally tears down all of the resources associated with it
	Teardown(ctx context.Context) error
}

Network provides an interface for configuring Nodes

func NewNetwork

func NewNetwork(constructor NetworkConstructor) Network

type NetworkConstructor

type NetworkConstructor interface {
	AddNode(ctx context.Context, config NodeConfig) (Node, error)
	Teardown(ctx context.Context) error
}

NetworkConstructor provides a thread safe interface for adding new nodes to a specific network Note: a NetworkConstructor is created as a network specific instance and used to implement a more feature complete Network backend without changing the fundamentals of the underlying network constructors.

type NetworkOrchestrator

type NetworkOrchestrator interface {
	CreateNetwork(name string) (Network, error)
	GetNetwork(name string) (Network, bool)
	Teardown(ctx context.Context) error
}

NetworkOrchestrator provides an interface to orchestrate networks using an arbitrary backend

type Node

type Node interface {
	GetName() string
	Config() map[string]interface{}
	GetHTTPBaseURI() string
	GetBootstrapIP() string
	Stop(timeout time.Duration) error // TODO pass in [ctx] instead of [timeout]
}

Node provides an interface to interact with a node on a given network

type NodeConfig

type NodeConfig struct {
	Name       string                 `json:"name"`       // Name of the node
	Executable string                 `json:"executable"` // Executable - docker image in this context
	Config     map[string]interface{} `json:"config"`     // Config string to be passed in via --config-file-content
	NodeID     string                 `json:"nodeID"`     // If non-empty, this contains the pre-configured nodeID of the node
}

Jump to

Keyboard shortcuts

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