scheduler

package
v0.0.0-...-3a937ec Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arbiter

type Arbiter struct {
	*supervisor.Control
	// contains filtered or unexported fields
}

func NewArbiter

func NewArbiter(ctx context.Context, log *logx.Log, name string, config ArbiterConfig) (a *Arbiter)

func (*Arbiter) Bind

func (a *Arbiter) Bind(id string, constraint manifest.Constraint, callback func(error, bus.Message))

Bind entity to arbiter

func (*Arbiter) ConsumeMessage

func (a *Arbiter) ConsumeMessage(message bus.Message) (err error)

func (*Arbiter) Open

func (a *Arbiter) Open() (err error)

func (*Arbiter) Unbind

func (a *Arbiter) Unbind(id string, callback func())

Unbind entity from arbiter

type ArbiterConfig

type ArbiterConfig struct {
	Required       manifest.Constraint
	ConstraintOnly []*regexp.Regexp
}

type BoundedEvaluator

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

func NewBoundedEvaluator

func NewBoundedEvaluator(binder ConstraintBinder, evaluator Evaluator) (e BoundedEvaluator)

type ConstraintBinder

type ConstraintBinder interface {
	Bind(id string, constraint manifest.Constraint, callback func(reason error, message bus.Message))
	Unbind(id string, callback func())
}

ConstraintBinder can bind and unbind specific function to specific callback

type Evaluator

type Evaluator interface {
	// Get constraint
	GetConstraint(pod *manifest.Pod) manifest.Constraint

	// Function to invoke then pod constraint is passed.
	// Allocate should be thread-safe and non-blocking
	Allocate(pod *manifest.Pod, env map[string]string)

	// Function to invoke then pod constraint is failed.
	// Deallocate should be thread-safe and non-blocking
	Deallocate(name string)
}

type RegistryConsumer

type RegistryConsumer interface {
	ConsumeRegistry(payload manifest.PodSlice)
}

type Sink

type Sink struct {
	*supervisor.Control
	// contains filtered or unexported fields
}

func NewSink

func NewSink(ctx context.Context, log *logx.Log, state allocation.PodSlice, boundedEvaluators ...BoundedEvaluator) (s *Sink)

func (*Sink) ConsumeMessage

func (s *Sink) ConsumeMessage(message bus.Message) (err error)

func (*Sink) ConsumeRegistry

func (s *Sink) ConsumeRegistry(registry manifest.PodSlice)

type SinkState

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

func NewSinkState

func NewSinkState(namespaces []string, dirty map[string]string) (s *SinkState)

func (*SinkState) SyncNamespace

func (s *SinkState) SyncNamespace(namespace string, pods manifest.PodSlice) (changes map[string]*manifest.Pod)

SyncNamespace syncs registry in specific namespace and returns actual changes

Jump to

Keyboard shortcuts

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