grpcsync

package
v2.2.0+incompatible Latest Latest
Warning

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

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

Documentation

Overview

Package grpcsync implements (in ALPHA VERSION) the gRPC client and server that satisfies the datasync API (see the definition of the service in ../syncbase/msg package). This implementation is special (comparing to dbsync or msgsync) because it does not use any intermediate persistence between the client and the server. Therefore the client does remote calls to each individual server/agent instance (and needs to know its IP address & port).

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is a default instance of Plugin.

Functions

This section is empty.

Types

type Adapter

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

Adapter is a gRPC transport adapter in front of Agent Plugins.

func NewAdapter

func NewAdapter(grpcServer *grpc.Server) *Adapter

NewAdapter creates a new instance of Adapter.

func (*Adapter) Close

func (adapter *Adapter) Close() error

Close closes the gRPC server.

func (*Adapter) Watch

func (adapter *Adapter) Watch(resyncName string, changeChan chan datasync.ChangeEvent,
	resyncChan chan datasync.ResyncEvent, keyPrefixes ...string) (datasync.WatchRegistration, error)

Watch registers HTTP handlers - basically bridges them with local dbadapter.

type DataMsgServiceServer

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

DataMsgServiceServer is //TODO

func NewDataMsgServiceServer

func NewDataMsgServiceServer(adapter *Adapter) *DataMsgServiceServer

NewDataMsgServiceServer creates a new instance of DataMsgServiceServer.

func (*DataMsgServiceServer) DataChanges

DataChanges propagates the events in the stream to go channels of registered plugins.

func (*DataMsgServiceServer) DataResyncs

DataResyncs propagates the events in the stream to go channels of registered plugins.

func (*DataMsgServiceServer) Ping

Ping checks the connectivity/ measures the minimal transport latency.

type Deps added in v1.0.4

type Deps struct {
	infra.PluginName
	GRPC grpc.Server
}

Deps represent Plugin dependencies.

type Option added in v1.5.0

type Option func(*Plugin)

Option is a function that can be used in NewPlugin to customize Plugin.

func UseDeps added in v1.5.0

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

type Plugin

type Plugin struct {
	Deps

	Adapter datasync.KeyValProtoWatcher
}

Plugin grpcsync implements Plugin interface, therefore can be loaded with other plugins.

func NewPlugin added in v1.5.0

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provided Options.

func (*Plugin) Close

func (p *Plugin) Close() error

Close does nothing.

func (*Plugin) Init

func (p *Plugin) Init() error

Init registers new gRPC service and instantiates plugin.Adapter.

Jump to

Keyboard shortcuts

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