consul

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTTL use to describe consul update period
	DefaultTTL = time.Minute
	// EnableTLS use to enable TSL
	EnableTLS = true
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Consul

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

Consul is an implementation of coodinator

func NewConsul

func NewConsul(addr, scheme, token string, log *logger.Logger) (*Consul, error)

NewConsul returns a Consul

func (*Consul) Deregister

func (c *Consul) Deregister(ctx context.Context, serviceID string) error

Deregister deregister a service

func (*Consul) GetServices

func (c *Consul) GetServices(ctx context.Context, name string, tag string) ([]*spec.Service, interface{}, error)

GetServices returns all service by context, name and tag

func (*Consul) Register

func (c *Consul) Register(ctx context.Context, serv *spec.Service, ttl time.Duration) error

Register register a new service

type TestConsul

type TestConsul struct {
	GetServicesServices []*spec.Service
	GetServicesMeta     *api.QueryMeta
	GetServicesError    error
	RegisterError       error
	DeregisterError     error
}

TestConsul is a help stub for test

func (*TestConsul) Deregister

func (t *TestConsul) Deregister(ctx context.Context, serviceID string) error

Deregister deregister a service which service do we want to deregister

func (*TestConsul) GetServices

func (t *TestConsul) GetServices(ctx context.Context, name string, tag string) ([]*spec.Service, interface{}, error)

GetServices returns some service which services do we want to return

func (*TestConsul) Register

func (t *TestConsul) Register(ctx context.Context, serv *spec.Service, ttl time.Duration) error

Register register a service which service do we want to register

Jump to

Keyboard shortcuts

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