registry

package
v0.8.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2015 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppRegistration

type AppRegistration struct {
	Name string
	Host string
	Port int
}

AppRegistration contains data about an app to be registered.

type HandlerRegistration

type HandlerRegistration struct {
	Name        string
	Host        string
	Path        string
	Methods     []string
	Middlewares []middleware.Middleware
}

HandlerRegistration contains data about a handler to be registered.

type Heartbeater

type Heartbeater struct {
	Running bool
	// contains filtered or unexported fields
}

Heartbeater periodically registers an application using the provided Registry.

func NewHeartbeater

func NewHeartbeater(registration *AppRegistration, registry Registry, interval time.Duration) *Heartbeater

NewHeartbeater creates a Heartbeater from the provided app and registry.

func (*Heartbeater) Start

func (h *Heartbeater) Start()

Start begins sending heartbeats.

func (*Heartbeater) Stop

func (h *Heartbeater) Stop()

Stop halts sending heartbeats.

func (*Heartbeater) Toggle

func (h *Heartbeater) Toggle()

Toggle starts or stops the Heartbeater based on whether it is already running.

type LBRegistry

type LBRegistry struct {
	Key string
	TTL uint64
	// contains filtered or unexported fields
}

LBRegistry is an implementation of Registry in which multiple instances of an application are able to accept requests at the same time. Internally, this registry uses GroupMasterRegistry by creating a unique group ID for each instance of an application.

func NewLBRegistry

func NewLBRegistry(key string, ttl uint64) (*LBRegistry, error)

NewLBRegistry creates a new LBRegistry from the provided etcd Client.

func (*LBRegistry) RegisterApp

func (s *LBRegistry) RegisterApp(registration *AppRegistration) error

RegisterApp adds a new backend and a single server with Vulcand.

func (*LBRegistry) RegisterHandler

func (s *LBRegistry) RegisterHandler(registration *HandlerRegistration) error

RegisterHandler registers the frontends and middlewares with Vulcand.

type LeaderRegistry

type LeaderRegistry struct {
	Key      string
	Group    string
	TTL      uint64
	IsMaster bool
	// contains filtered or unexported fields
}

LeaderRegistry is an implementation of Registry that uses a single master instance of an application within a given group to handle requests. When the master instance fails, request handling will automatically failover to a slave instance.

func NewLeaderRegistry

func NewLeaderRegistry(key string, group string, ttl uint64) *LeaderRegistry

NewLeaderRegistry creates a new LeaderRegistry from the provided etcd Client.

func (*LeaderRegistry) RegisterApp

func (s *LeaderRegistry) RegisterApp(registration *AppRegistration) error

RegisterApp adds a new backend and a single server with Vulcand.

func (*LeaderRegistry) RegisterHandler

func (s *LeaderRegistry) RegisterHandler(registration *HandlerRegistration) error

RegisterHandler registers the frontends and middlewares with Vulcand.

type NopRegistry

type NopRegistry struct {
}

NopRegistry is an implementation of Registry for applications that do not need service discovery.

func (*NopRegistry) RegisterApp

func (s *NopRegistry) RegisterApp(*AppRegistration) error

RegisterApp is a no-op.

func (*NopRegistry) RegisterHandler

func (s *NopRegistry) RegisterHandler(*HandlerRegistration) error

RegisterHandler is a no-op.

type Registry

type Registry interface {
	RegisterApp(r *AppRegistration) error
	RegisterHandler(r *HandlerRegistration) error
}

Registry is an interface that all built-in and user-defined registries implement.

Jump to

Keyboard shortcuts

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