registry

package
v0.0.0-...-cbea63e Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hosts

func Hosts() ([]string, error)

func Init

func Init()

func Register

func Register(instance *Instance) error

Register registers an instance with this discovery service Upon successful registration, this instance of the discovery service will send periodic heartbeats to check the service it alive, and is then responsible for removing it if it dies

func Unregister

func Unregister(instanceId string) error

Unregister removes an instance, by ID, plus any endpoints running within this instance

Types

type Endpoint

type Endpoint struct {
	// Name of this endpoint
	Name string
	// Subscribe is the topic to SUB to if this endpoint is a subscription endpoint
	Subscribe string
	// Sla that this endpoint promises to keep
	Sla Sla
}

Endpoint is a single H2 endpoint which can either be called via REQ/REP or will SUB to messages (for PUB/SUB)

type Filter

type Filter func(inst *Instance) bool

Filter defines a single way of filtering out instances, where returning true indicates something SHOULD be removed (filtered out)

func MatchingAz

func MatchingAz(az string) Filter

MatchingAz filter by availability zone

func MatchingService

func MatchingService(name string) Filter

MatchingService filter by service name (exact match)

func MatchingServicePrefix

func MatchingServicePrefix(p string) Filter

MatchingServicePrefix filter by service name

type Instance

type Instance struct {
	Id           string
	Hostname     string
	MachineClass string
	Name         string
	Description  string
	AzName       string
	Source       string
	OwnerEmail   string
	OwnerMobile  string
	OwnerTeam    string
	Version      uint64
	Endpoints    []*Endpoint
}

Instance is a single running version of a service on a single host

func (Instance) GetSubTopics

func (inst Instance) GetSubTopics() []string

GetSubTopics returns a list of the Subscribe topics for each Endpoint this instance contains

type Instances

type Instances []*Instance

Instances represents a list of instances

func AllInstances

func AllInstances() Instances

AllInstances returns a snapshot of all instances for further in-memory manipulation

func (Instances) Filter

func (list Instances) Filter(f Filter) Instances

Filter returns a list of filtered instances

type Sla

type Sla struct {
	// Mean is the mean avg response time (time to generate response) promised for this endpoint
	Mean uint32
	// Upper95 is 95th percentile response promised for this endpoint
	Upper95 uint32
}

Sla defines how we expect an instance to perform in terms of response times, resource usage etc.

Jump to

Keyboard shortcuts

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