bridge

package
v1.0.0-alpha-01-28-201... Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdapterFactories = &adapterFactoryExt{
	newExtensionPoint(new(AdapterFactory)),
}

AdapterFactories maintains a list of Extension points

Functions

func Register

func Register(component interface{}, name string) []string

Register function will provide registration mechanism

func Unregister

func Unregister(name string) []string

Unregister functions implements unregistering from service-registry

Types

type AdapterFactory

type AdapterFactory interface {
	New(uri *url.URL) (RegistryAdapter, error)
}

AdapterFactory implements the ServiceRegistrator

type Bridge

type Bridge struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Bridge maintains consolidated information to process Service registering

func New

func New(adapterURI string, config Config) (*Bridge, error)

New creates a new bridge between the Registry providers and containers

func (*Bridge) AddService

func (b *Bridge) AddService(srvID string, srvName string, nwName string, tenantName string, srvIP string)

AddService adds a new service to registry when triggered from dockplugin

func (*Bridge) Ping

func (b *Bridge) Ping() error

Ping will try to connect to the registry

func (*Bridge) Refresh

func (b *Bridge) Refresh()

Refresh will keep the registry uptodate by monitoring for any changes

func (*Bridge) RemoveService

func (b *Bridge) RemoveService(srvID string, srvName string, nwName string, tenantName string, srvIP string)

RemoveService removes service from registry when triggered from dockplugin

type Config

type Config struct {
	HostIP          string
	Internal        bool
	ForceTags       string
	RefreshTTL      int
	RefreshInterval int
	DeregisterCheck string
	RetryInterval   int
	RetryAttempts   int
}

Config maintains the supplementing state of the service

Field descriptions:
* HostIP:          IP for ports mapped to the host
* Internal:        Use internal ports instead of published ones
* ForceTags:       Append tags for all registered services
* RefreshTTL:      TTL for services (default is no expiry)
* RefreshInterval: Frequency with which service TTLs are refreshed
* DeregisterCheck: Deregister exited services "always" or "on-success"
* RetryAttempts:   Max retry attempts to establish a connection with the
*                  backend. Use -1 for infinite retries
* RetryInterval:   Interval (in millisecond) between retry-attempts

func DefaultBridgeConfig

func DefaultBridgeConfig() Config

DefaultBridgeConfig sets the default configuration for Bridge config

type RegistryAdapter

type RegistryAdapter interface {
	Ping() error
	Register(service *Service) error
	Deregister(service *Service) error
	Refresh(service *Service) error
}

RegistryAdapter defines the interface that ServiceRegistrators must implement

type Service

type Service struct {
	ID      string
	Name    string
	Network string
	Tenant  string
	Port    int
	IP      string
	Tags    []string
	Attrs   map[string]string
	TTL     int
}

Service defines the state required for the configuration on the service

Jump to

Keyboard shortcuts

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