orchestrator

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is default instance of Plugin

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
}

Deps represents dependencies for the plugin.

type Dispatcher

type Dispatcher interface {
	ListData() KVPairs
	PushData(context.Context, []KeyVal) ([]kvs.KeyWithError, error)
}

type KVPairs

type KVPairs map[string]proto.Message

KVPairs represents key-value pairs.

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) 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) PushData

func (p Plugin) PushData(ctx context.Context, kvPairs []KeyVal) (kvErrs []kvs.KeyWithError, err error)

PushData updates actual data.

Jump to

Keyboard shortcuts

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