registry

package
v0.0.0-...-f4e9d25 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2014 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExists    = errors.New("Service already exists in registry")
	ErrNotExists = errors.New("Service does not exist in registry")
)

Functions

This section is empty.

Types

type DefaultRegistry

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

DefaultRegistry is a datastore for registered services.

func (*DefaultRegistry) Add

func (r *DefaultRegistry) Add(s msg.Service) error

Add adds a service to registry.

func (*DefaultRegistry) AddCallback

func (r *DefaultRegistry) AddCallback(s msg.Service, c msg.Callback) error

AddCallback adds callback c to the service s.

func (*DefaultRegistry) Get

func (r *DefaultRegistry) Get(domain string) ([]msg.Service, error)

Get retrieves a list of services from the registry that matches the given domain pattern:

uuid.host.region.version.service.environment any of these positions may supply the wildcard "*", to have all values match in this position. additionally, you only need to specify as much of the domain as needed the domain version.service.environment is perfectly acceptable, and will assume "*" for all the ommited subdomain positions

func (*DefaultRegistry) GetExpired

func (r *DefaultRegistry) GetExpired() (uuids []string)

GetExpired returns a slice of expired UUIDs.

func (*DefaultRegistry) GetUUID

func (r *DefaultRegistry) GetUUID(uuid string) (s msg.Service, err error)

GetUUID retrieves a service based on its UUID.

func (*DefaultRegistry) Len

func (r *DefaultRegistry) Len() int

Len returns the size of the registry r.

func (*DefaultRegistry) Remove

func (r *DefaultRegistry) Remove(s msg.Service) (err error)

Remove removes a service from registry.

func (*DefaultRegistry) RemoveUUID

func (r *DefaultRegistry) RemoveUUID(uuid string) error

RemoveUUID removes a sErvice specified by an UUID.

func (*DefaultRegistry) UpdateTTL

func (r *DefaultRegistry) UpdateTTL(uuid string, ttl uint32, expires time.Time) error

UpdateTTL updates the TTL of a service, as well as pushes the expiration time out TTL seconds from now. This serves as a ping, for the service to keep SkyDNS aware of it's existence so that it is not expired, and purged.

type Registry

type Registry interface {
	Add(s msg.Service) error
	Get(domain string) ([]msg.Service, error)
	GetUUID(uuid string) (msg.Service, error)
	GetExpired() []string
	Remove(s msg.Service) error
	RemoveUUID(uuid string) error
	UpdateTTL(uuid string, ttl uint32, expires time.Time) error
	AddCallback(s msg.Service, c msg.Callback) error
	Len() int
}

func New

func New() Registry

New returns a new DefaultRegistry.

Jump to

Keyboard shortcuts

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