orchestrator

package
v3.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: Apache-2.0 Imports: 33 Imported by: 8

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 EnabledGrpcMetrics added in v3.1.0

func EnabledGrpcMetrics()

func UnmarshalLazyValue

func UnmarshalLazyValue(key string, lazy datasync.LazyValue) (proto.Message, error)

UnmarshalLazyValue is helper function for unmarshalling from datasync.LazyValue.

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

func UseReflection added in v3.1.0

func UseReflection(enabled bool) Option

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) Close added in v3.2.0

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

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() error

InitialSync will start initial synchronization.

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 = kvscheduler.ValueStatus

Directories

Path Synopsis
Package contextdecorator handles insertions and extractions of orchestrator related data from context.
Package contextdecorator handles insertions and extractions of orchestrator related data from context.

Jump to

Keyboard shortcuts

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