modelcache

package
v0.0.0-...-8ff1004 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractCacheController

func ExtractCacheController(in worker.Worker, out interface{}) error

ExtractCacheController extracts a *cache.Controller from a *cacheWorker.

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold that will run a model cache worker. The manifold outputs a *cache.Controller, primarily for the apiserver to depend on and use.

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

NewWorker creates a new cacheWorker, and starts an all model watcher.

Types

type Config

type Config struct {
	Logger               Logger
	StatePool            *state.StatePool
	PrometheusRegisterer prometheus.Registerer
	Cleanup              func()
	// Notify is used primarily for testing, and is passed through
	// to the cache.Controller. It is called every time the controller
	// processes an event.
	Notify func(interface{})
}

Config describes the necessary fields for NewWorker.

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures all the necessary values are specified

type Logger

type Logger interface {
	IsTraceEnabled() bool
	Tracef(string, ...interface{})
	Errorf(string, ...interface{})
}

Logger describes the logging methods used in this package by the worker.

type ManifoldConfig

type ManifoldConfig struct {
	StateName string
	Logger    Logger

	PrometheusRegisterer prometheus.Registerer

	NewWorker func(Config) (worker.Worker, error)
}

ManifoldConfig holds the information necessary to run a model cache worker in a dependency.Engine.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate validates the manifold configuration.

Jump to

Keyboard shortcuts

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