orchestrator

package
v2.3.0-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is default instance of Plugin

View Source
var (
	// EnableStatusPublishing enables status publishing.
	EnableStatusPublishing = os.Getenv("ENABLE_STATUS_PUBLISHING") != ""
)

Functions

func DataSrcContext

func DataSrcContext(ctx context.Context, dataSrc string) context.Context

func DataSrcFromContext

func DataSrcFromContext(ctx context.Context) (dataSrc string, ok bool)

Types

type Deps

type Deps struct {
	infra.PluginDeps

	GRPC            grpc.Server
	KVScheduler     kvs.KVScheduler
	Watcher         datasync.KeyValProtoWatcher
	StatusPublisher datasync.KeyProtoValWriter
}

Deps represents dependencies for the plugin.

type Dispatcher

type Dispatcher interface {
	ListData() KVPairs
	PushData(context.Context, []KeyVal) ([]Result, error)
	GetStatus(key string) (*Status, error)
	ListState() (KVPairs, error)
}

type KVPairs

type KVPairs map[string]proto.Message

KVPairs represents key-value pairs.

type KVStore

type KVStore interface {
	ListAll() KVPairs
	List(dataSrc string) KVPairs
	Update(dataSrc, key string, val proto.Message)
	Delete(dataSrc, key string)
	Reset(dataSrc string)
}

KVStore describes an interface for key-value store used by dispatcher.

type KeyVal

type KeyVal struct {
	Key string
	Val proto.Message
}

KeyVal associates value with its key.

type Option

type Option func(*Plugin)

Option is a function that acts on a Plugin to inject Dependencies or configuration

type Plugin

type Plugin struct {
	Deps
	// contains filtered or unexported fields
}

Plugin implements sync service for GRPC.

func NewPlugin

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provides Options

func (*Plugin) AfterInit

func (p *Plugin) AfterInit() (err error)

AfterInit subscribes to known NB prefixes.

func (Plugin) GetStatus

func (p Plugin) GetStatus(key string) (*Status, error)

func (*Plugin) Init

func (p *Plugin) Init() (err error)

Init registers the service to GRPC server.

func (*Plugin) InitialSync

func (p *Plugin) InitialSync()

InitialSync will start initial synchronization with downstream.

func (Plugin) ListData

func (p Plugin) ListData() KVPairs

ListData retrieves actual data.

func (Plugin) ListState

func (p Plugin) ListState() (KVPairs, error)

ListState retrieves running state.

func (Plugin) PushData

func (p Plugin) PushData(ctx context.Context, kvPairs []KeyVal) (results []Result, err error)

PushData updates actual data.

type Result

type Result struct {
	Key    string
	Status *Status
}

type Status

type Status = kvs.ValueStatus

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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