discovery

package module
v0.0.0-...-06f494d Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2019 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MonitorExportedService

func MonitorExportedService(
	kv etcd.KV, watcher etcd.Watcher, basePath string,
	receiver ExportedServiceNotificationReceiver)

MonitorExportedService creates a new monitor for updates on the given baseString in the specified etcdClient. See the documentation of the ExportedServiceNotificationReceiver interface for more details.

func NewGrpcClient

func NewGrpcClient(ctx context.Context, client etcd.KV, path string,
	opts ...grpc.DialOption) (*grpc.ClientConn, error)

NewGrpcClient attempts to establish grpc client connections with the specified options to the endpoints connected with the etcd prefix. If multiple destinations are linked to the destination (e.g. through a service subdirectory), a connection is attempted to each backend in random order. In case of connection errors the target is skipped and the next one is attempted.

Once established, aborted connections will not be reestablished to a different endpoint.

func NewSimpleClient

func NewSimpleClient(ctx context.Context, client etcd.KV, path string) (
	net.Conn, error)

NewSimpleClient determines the correct connection endpoints matching the specified path and attempts to connect to them. If multiple destinations are linked to the destination (e.g. through a service subdirectory), a connection is attempted to each backend in random order. In case of connection errors the target is skipped and the next one is attempted.

The connections returned are regular connections, if they are interrupted they will not be reestablished.

func StopMonitoringExportedServices

func StopMonitoringExportedServices(watcher etcd.Watcher) error

StopMonitoringExportedServices stops monitoring _all_ exported services as well as any other watchers registered on the specified etcd server.

Types

type ExportedServiceNotificationReceiver

type ExportedServiceNotificationReceiver interface {
	/*
	   ReportChange is used to indicate to the caller that a change has occurred to
	   the list of backends. The details of the change are transported in the
	   ExportedServiceUpdateNotification.
	*/
	ReportChange(*ExportedServiceUpdateNotification)

	/*
	   ReportError is used to indicate a non-fatal error to the caller.
	*/
	ReportError(error)

	/*
	   ReportFatal is used to indicate a fatal error to the caller. After this
	   event is fired, listening to modifications will stop.
	*/
	ReportFatal(error)

	/*
	   ReportCancelled reports that the watcher has been cancelled, which can be
	   used as a signal to the notification receiver to shut down.
	*/
	ReportCancelled()
}

ExportedServiceNotificationReceiver is an interface used by the exported service monitor to notify the caller of changes.

Directories

Path Synopsis
Package exporter provides exported named etcd ports.
Package exporter provides exported named etcd ports.
testing
mock_etcd
Package mock_etcd is a generated GoMock package.
Package mock_etcd is a generated GoMock package.
mock_grpc
Package mock_mock_grpc is a generated GoMock package.
Package mock_mock_grpc is a generated GoMock package.
mock_net
Package mock_net is a generated GoMock package.
Package mock_net is a generated GoMock package.

Jump to

Keyboard shortcuts

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