sd

package
v0.0.0-...-1c5eda6 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package sd provides utilities related to service discovery. That includes the client-side loadbalancer pattern, where a microservice subscribes to a service discovery system in order to reach remote instances; as well as the registrator pattern, where a microservice registers itself in a service discovery system. Implementations are provided for most common systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory func(instance string) (endpoint.Endpoint, io.Closer, error)

Factory is a function that converts an instance string (e.g. host:port) to a specific endpoint. Instances that provide multiple endpoints require multiple factories. A factory also returns an io.Closer that's invoked when the instance goes away and needs to be cleaned up. Factories may return nil closers.

Users are expected to provide their own factory functions that assume specific transports, or can deduce transports by parsing the instance string.

type FixedSubscriber

type FixedSubscriber []endpoint.Endpoint

FixedSubscriber yields a fixed set of services.

func (FixedSubscriber) Endpoints

func (s FixedSubscriber) Endpoints() ([]endpoint.Endpoint, error)

Endpoints implements Subscriber.

type Registrar

type Registrar interface {
	Register()
	Deregister()
}

Registrar registers instance information to a service discovery system when an instance becomes alive and healthy, and deregisters that information when the service becomes unhealthy or goes away.

Registrar implementations exist for various service discovery systems. Note that identifying instance information (e.g. host:port) must be given via the concrete constructor; this interface merely signals lifecycle changes.

type Subscriber

type Subscriber interface {
	Endpoints() ([]endpoint.Endpoint, error)
}

Subscriber listens to a service discovery system and yields a set of identical endpoints on demand. An error indicates a problem with connectivity to the service discovery system, or within the system itself; a subscriber may yield no endpoints without error.

Directories

Path Synopsis
Package consul provides subscriber and registrar implementations for Consul.
Package consul provides subscriber and registrar implementations for Consul.
Package dnssrv provides a subscriber implementation for DNS SRV records.
Package dnssrv provides a subscriber implementation for DNS SRV records.
Package etcd provides a subscriber implementation for etcd.
Package etcd provides a subscriber implementation for etcd.
Package lb implements the client-side load balancer pattern.
Package lb implements the client-side load balancer pattern.
Package zk provides subscriber and registrar implementations for ZooKeeper.
Package zk provides subscriber and registrar implementations for ZooKeeper.

Jump to

Keyboard shortcuts

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