discovery

package
v0.0.0-...-0e304bb Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_TIMEOUT = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Name() string
	//Creates a new parralel procedure to watch for changes
	Discover(context.Context, string) (<-chan Change, error)
}

func CreateBackend

func CreateBackend(descriptor string) (Backend, error)

func NewConsulBackend

func NewConsulBackend(uri *url.URL) (Backend, error)

func NewDNSBackend

func NewDNSBackend(uri *url.URL) (Backend, error)

type Change

type Change struct {
	Index uint64
	List  []*Service
}

func (Change) String

func (c Change) String() string

type Client

type Client interface {
	DiscoverOnce(string) ([]*Service, error)
	Discover(string) (Discovery, error)
	Close() error
}

func NewFromEnv

func NewFromEnv() (Client, error)

type ConsulBackend

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

func (*ConsulBackend) Discover

func (b *ConsulBackend) Discover(ctx context.Context, name string) (<-chan Change, error)

func (*ConsulBackend) Name

func (b *ConsulBackend) Name() string

type DNSBackend

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

func (*DNSBackend) Discover

func (b *DNSBackend) Discover(ctx context.Context, name string) (<-chan Change, error)

func (*DNSBackend) Name

func (b *DNSBackend) Name() string

type Discovery

type Discovery interface {
	Updates() <-chan Change
	Close()
}

func NewDiscovery

func NewDiscovery(ctx context.Context, b Backend, id string) (Discovery, error)

type Service

type Service struct {
	Address string
	Port    int
}

func (Service) String

func (s Service) String() string

Jump to

Keyboard shortcuts

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