Documentation
¶
Index ¶
- Variables
- type DefaultRegistry
- func (r *DefaultRegistry) Add(s msg.Service) error
- func (r *DefaultRegistry) AddCallback(s msg.Service, c msg.Callback) error
- func (r *DefaultRegistry) Get(domain string) ([]msg.Service, error)
- func (r *DefaultRegistry) GetExpired() (uuids []string)
- func (r *DefaultRegistry) GetUUID(uuid string) (s msg.Service, err error)
- func (r *DefaultRegistry) Len() int
- func (r *DefaultRegistry) Remove(s msg.Service) (err error)
- func (r *DefaultRegistry) RemoveUUID(uuid string) error
- func (r *DefaultRegistry) UpdateTTL(uuid string, ttl uint32, expires time.Time) error
- type Registry
Constants ¶
This section is empty.
Variables ¶
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 ¶
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.
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 }