controller

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	Start()
	Shutdown()

	Watcher() Watcher

	AddEntityHandler(h EntityHandler)
}

Controller defines an interface for a generic controller

func NewController

func NewController(store entitystore.EntityStore, options Options) Controller

NewController creates a new controller

type DefaultController

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

DefaultController defines a struct for a generic controller

func (*DefaultController) AddEntityHandler

func (dc *DefaultController) AddEntityHandler(h EntityHandler)

AddEntityHandler adds entity handlers

func (*DefaultController) Shutdown

func (dc *DefaultController) Shutdown()

Shutdown stops the controller loop

func (*DefaultController) Start

func (dc *DefaultController) Start()

Start starts the controller watch loop

func (*DefaultController) Watcher

func (dc *DefaultController) Watcher() Watcher

type EntityHandler

type EntityHandler interface {
	Type() reflect.Type
	Add(obj entitystore.Entity) error
	Update(obj entitystore.Entity) error
	Delete(obj entitystore.Entity) error
	Error(obj entitystore.Entity) error
}

EntityHandler define an interface for entity operations of a generic controller

type Options

type Options struct {
	OrganizationID string
	Namespace      string

	ResyncPeriod time.Duration
	Workers      int
}

Options defines controller configuration

type Watcher

type Watcher chan<- entitystore.Entity

func (*Watcher) OnAction

func (w *Watcher) OnAction(e entitystore.Entity)

Jump to

Keyboard shortcuts

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