engine

package
v0.0.0-...-398fed0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStatsLogger

func NewStatsLogger(config *config.BalancerConfig) *logrus.Logger

Types

type Command

type Command struct {
	Op          CommandOp
	Service     *types.Service
	Destination *types.Destination
	Response    chan interface{} `json:"-"`
}

Command represents a command in raft log

func (Command) String

func (c Command) String() string

type CommandOp

type CommandOp int
const (
	AddServiceOp CommandOp = iota
	DelServiceOp
	AddDestinationOp
	DelDestinationOp
)

Represents possible actions on engine

func (CommandOp) String

func (i CommandOp) String() string

type Engine

type Engine struct {
	sync.Mutex

	Ipvs     *ipvs.Ipvs
	State    ipvs.State
	Provider provider.Provider
	StateCh  chan chan error

	StatsLogger *logrus.Logger
}

Engine ...

func New

func New(config *config.BalancerConfig) (*Engine, error)

New creates a new Engine

func (*Engine) Apply

func (e *Engine) Apply(l *raft.Log) interface{}

Apply actions to fsm

func (*Engine) CollectStats

func (e *Engine) CollectStats(tick time.Time)

func (*Engine) Restore

func (e *Engine) Restore(rc io.ReadCloser) error

Restore stores the key-value store to a previous state.

func (*Engine) Snapshot

func (e *Engine) Snapshot() (raft.FSMSnapshot, error)

Jump to

Keyboard shortcuts

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