registry

package
v0.0.0-...-2cf5803 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Guard

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

Guard count the renew of all operations for self protection

type Node

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

Node represents a peer node to which information should be shared from this node.

This struct handles replicating all update operations like 'Register,Renew,Cancel,Expiration and Status Changes' to the <Discovery Server> node it represents.

func (*Node) Cancel

func (n *Node) Cancel(c context.Context, i *model.Instance) (err error)

Cancel send the cancellation information of Instance receiving by this node to the peer node represented.

func (*Node) Register

func (n *Node) Register(c context.Context, i *model.Instance) (err error)

Register send the registration information of Instance receiving by this node to the peer node represented.

func (*Node) Renew

func (n *Node) Renew(c context.Context, i *model.Instance) (err error)

Renew send the heartbeat information of Instance receiving by this node to the peer node represented. If the instance does not exist the node, the instance registration information is sent again to the peer node.

type Nodes

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

Nodes is helper to manage lifecycle of a collection of Nodes.

func NewNodes

func NewNodes(c *conf.Config) *Nodes

NewNodes new nodes and return.

func (*Nodes) AllNodes

func (ns *Nodes) AllNodes() (nsi []*model.Node)

AllNodes returns nodes contain other zone nodes.

func (*Nodes) Myself

func (ns *Nodes) Myself(addr string) bool

Myself returns whether or not myself.

func (*Nodes) Nodes

func (ns *Nodes) Nodes() (nsi []*model.Node)

Nodes returns nodes of local zone.

func (*Nodes) Replicate

func (ns *Nodes) Replicate(c context.Context, action model.Action, i *model.Instance, otherZone bool) (err error)

Replicate replicate information to all nodes except for this node.

func (*Nodes) UP

func (ns *Nodes) UP()

UP marks status of myself node up.

type Registry

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

Registry handles replication of all operations to peer Discovery nodes to keep them all in sync.

func NewRegistry

func NewRegistry(conf *conf.Config) (r *Registry)

NewRegistry new register.

func (*Registry) Cancel

func (r *Registry) Cancel(arg *model.ArgCancel) (i *model.Instance, ok bool)

Cancel cancels the registration of an instance.

func (*Registry) DelConns

func (r *Registry) DelConns(arg *model.ArgPolls)

DelConns delete conn of host in appid

func (*Registry) Fetch

func (r *Registry) Fetch(zone, env, appid string, latestTime int64, status uint32) (info *model.InstanceInfo, err error)

Fetch fetch all instances by appid.

func (*Registry) FetchAll

func (r *Registry) FetchAll() (im map[string][]*model.Instance)

FetchAll fetch all instances of all the families.

func (*Registry) Polls

func (r *Registry) Polls(arg *model.ArgPolls) (ch chan map[string]*model.InstanceInfo, new bool, err error)

Polls hangs request and then write instances when that has changes, or return NotModified.

func (*Registry) Register

func (r *Registry) Register(ins *model.Instance, latestTime int64) (err error)

Register a new instance.

func (*Registry) Renew

func (r *Registry) Renew(arg *model.ArgRenew) (i *model.Instance, ok bool)

Renew marks the given instance of the given app name as renewed, and also marks whether it originated from replication.

func (*Registry) Set

func (r *Registry) Set(arg *model.ArgSet) (ok bool)

Set Set the metadata of instance by hostnames.

Jump to

Keyboard shortcuts

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