strategies

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoStrategy = errors.New("strategy does not exist")
)

Functions

This section is empty.

Types

type Context added in v0.1.1

type Context struct {
	MessagePool *types.MessageStore
	// Replicas reference to the replica store
	Replicas *types.ReplicaStore
	// EventDAG is the directed acyclic graph all prior events
	EventDAG *types.EventDAG
	// Vars is a generic key value store to facilate maintaining auxilliary information
	// during the execution of a testcase
	Vars *types.VarSet

	PendingMessages *types.MessageStore
}

type DefaultFilter added in v0.1.1

type DefaultFilter struct {
	// contains filtered or unexported fields
}

func NewDefaultFilter added in v0.1.1

func NewDefaultFilter(ctx *context.RootContext) *DefaultFilter

func (*DefaultFilter) Step added in v0.1.1

func (d *DefaultFilter) Step(e *types.Event) []*types.Message

type Driver

type Driver struct {
	*types.BaseService
	// contains filtered or unexported fields
}

func GetStrategy

func GetStrategy(ctx *context.RootContext, s string) (*Driver, error)

func NewDriver

func NewDriver(ctx *context.RootContext, strategy Strategy) *Driver

func (*Driver) Name

func (srv *Driver) Name() string

Name implements DashboardRouter

func (*Driver) SetupRouter

func (srv *Driver) SetupRouter(router *gin.RouterGroup)

SetupRouter for setting up the dashboard routes implements DashboardRouter

func (*Driver) Start

func (d *Driver) Start() error

func (*Driver) Stop

func (d *Driver) Stop() error

type DummyStrategy added in v0.1.1

type DummyStrategy struct {
	*types.BaseService
	// contains filtered or unexported fields
}

func NewDummyStrategy added in v0.1.1

func NewDummyStrategy(ctx *context.RootContext) *DummyStrategy

func (*DummyStrategy) Start added in v0.1.1

func (d *DummyStrategy) Start() error

func (*DummyStrategy) Step added in v0.1.1

func (d *DummyStrategy) Step(event *types.Event, _ []*types.Message) []*types.Message

func (*DummyStrategy) Stop added in v0.1.1

func (d *DummyStrategy) Stop() error

type Filter added in v0.1.1

type Filter interface {
	Step(*types.Event) []*types.Message
}

type Strategy

type Strategy interface {
	types.Service
	// Step returns the messages to be delivered to the replicas,
	// Arguments are
	// 1. The new event received from the replicas
	// 2. Context containing a set of possible messages that can be delivered
	Step(*types.Event, []*types.Message) []*types.Message
}

type StrategyChain added in v0.1.1

type StrategyChain struct {
	*types.BaseService
	// contains filtered or unexported fields
}

func NewStrategyChain added in v0.1.1

func NewStrategyChain(ctx *context.RootContext, strategies ...Strategy) *StrategyChain

func (*StrategyChain) AddStrategy added in v0.1.1

func (c *StrategyChain) AddStrategy(s Strategy)

func (*StrategyChain) Start added in v0.1.1

func (c *StrategyChain) Start() error

func (*StrategyChain) Step added in v0.1.1

func (c *StrategyChain) Step(e *types.Event, in []*types.Message) []*types.Message

func (*StrategyChain) Stop added in v0.1.1

func (c *StrategyChain) Stop() error

type TimeoutStrategy added in v0.1.1

type TimeoutStrategy struct {
	*types.BaseService
	// contains filtered or unexported fields
}

func NewTimeoutStrategy added in v0.1.1

func NewTimeoutStrategy(ctx *context.RootContext) *TimeoutStrategy

func (*TimeoutStrategy) Step added in v0.1.1

func (t *TimeoutStrategy) Step(e *types.Event, in []*types.Message) []*types.Message

Jump to

Keyboard shortcuts

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