converger

package
v0.0.0-...-c4c28c6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2016 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package converger is a facility for reporting the converged state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConverger

func NewConverger(timeout int, stateFn func(bool) error) *converger

NewConverger builds a new converger struct

Types

type Converger

type Converger interface {
	Register() ConvergerUID
	IsConverged(ConvergerUID) bool         // is the UID converged ?
	SetConverged(ConvergerUID, bool) error // set the converged state of the UID
	Unregister(ConvergerUID)
	Start()
	Pause()
	Loop(bool)
	ConvergedTimer(ConvergerUID) <-chan time.Time
	Status() map[uint64]bool
	Timeout() int                // returns the timeout that this was created with
	SetStateFn(func(bool) error) // sets the stateFn
}

Converger is the general interface for implementing a convergence watcher

type ConvergerUID

type ConvergerUID interface {
	ID() uint64   // get Id
	Name() string // get a friendly name
	SetName(string)
	IsValid() bool // has Id been initialized ?
	InvalidateID() // set Id to nil
	IsConverged() bool
	SetConverged(bool) error
	Unregister()
	ConvergedTimer() <-chan time.Time
	StartTimer() (func() error, error) // cancellable is the same as StopTimer()
	ResetTimer() error                 // resets counter to zero
	StopTimer() error
}

ConvergerUID is the interface resources can use to notify with if converged you'll need to use part of the Converger interface to Register initially too

Jump to

Keyboard shortcuts

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