plan

package
v0.0.0-...-e71dbe6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const FinishedState = sync.State("finished")

FinishedState coordinates plan completion

Variables

View Source
var ActorInfoTopic = sync.NewTopic("actor-info", &sim.ActorInfo{})

ActorInfoTopic represents a subtree under the test run's sync tree where peers participating in this distributed test advertise their attributes

View Source
var ReadyStateActorInfoSync = sync.State("actor info published")
View Source
var ReadyStateConstructed = sync.State("actor constructed")

ReadyStateConstructed is the state to sync on to ensure all actors have been constructed before moving on

Functions

This section is empty.

Types

type ActorConstructor

type ActorConstructor func(context.Context, *Plan) (*sim.Actor, error)

ActorConstructor is a function that creates an actor

type Plan

type Plan struct {
	Cfg    *PlanConfig
	Runenv *runtime.RunEnv
	Client sync.Client

	Seq int64

	Actor  *sim.Actor
	Others map[string]*sim.ActorInfo
	// contains filtered or unexported fields
}

Plan holds state for test plan execution, one plan instance is constructed per node in the plan, with methods for syncronizing plan instances out-of-band from the test itself

func NewPlan

func NewPlan(ctx context.Context, runenv *runtime.RunEnv) *Plan

NewPlan creates a plan instance from runtime data

func (*Plan) ActorFinished

func (plan *Plan) ActorFinished(ctx context.Context) error

ActorFinished marks this actor as having completed their goal for the plan

func (*Plan) Close

func (plan *Plan) Close()

Close finalizes the plan & cleans up resources

func (*Plan) ConstructActor

func (plan *Plan) ConstructActor(ctx context.Context, constructor ActorConstructor) error

ConstructActor creates an actor and assigns it to the plan it's mainly sugar for presnting a uniform plan execution API

func (*Plan) DialOtherPeers

func (plan *Plan) DialOtherPeers(ctx context.Context) ([]peer.AddrInfo, error)

DialOtherPeers dials a portion of peers

func (*Plan) Finished

func (plan *Plan) Finished(ctx context.Context) <-chan error

Finished blocks until the plan is finished

func (*Plan) SetupNetwork

func (plan *Plan) SetupNetwork(ctx context.Context) error

SetupNetwork configures the network for plan execution

func (*Plan) ShareInfo

func (plan *Plan) ShareInfo(ctx context.Context) error

ShareInfo sends the nodes AddrInfo to all other nodes as well as stores the other nodes info in its peerstore

type PlanConfig

type PlanConfig struct {
	Timeout time.Duration
	Latency time.Duration
}

PlanConfig encapsulates test plan paremeters

func PlanConfigFromRuntimeEnv

func PlanConfigFromRuntimeEnv(runenv *runtime.RunEnv) *PlanConfig

PlanConfigFromRuntimeEnv parses configuration from the runtime environment

Jump to

Keyboard shortcuts

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