_package

package
v0.0.0-...-5ce4331 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegUrl         = "/register"
	ZoneIdsUrl     = "/zones"
	ZoneUrl        = "/zone"
	DetailsUrl     = "/details"
	DetailsUrlJson = "/details/json"
	ShutdownUrl    = "/shutdown"
	ResetUrl       = "/reset"
)

Variables

This section is empty.

Functions

func Clear

func Clear()

func Run

func Run(addr string, reg *registry)

Run configures the http Run and handlers

func Setup

func Setup() *registry

func ShutDown

func ShutDown()

Types

type Client

type Client interface {
	// Register self at this address/zone with registry
	Register(address string, meta MetaData) PeerResponse
	// GetZoneIds returns the zoneIds
	GetZoneIds() []int
	// GetZonePeers returns the addresses of zone peers
	GetZonePeers(zone int) PeerResponse
	// contains filtered or unexported methods
}

func NewClient

func NewClient(serverAddress string) Client

type MetaData

type MetaData interface{}

type PeerResponse

type PeerResponse []RegisterRequest

func (*PeerResponse) GetPeerAddr

func (pr *PeerResponse) GetPeerAddr(exclude string) []string

func (*PeerResponse) GetPeerMeta

func (pr *PeerResponse) GetPeerMeta() []MetaData

type PingMeta

type PingMeta interface{}

type RegisterRequest

type RegisterRequest struct {
	RegisterAt time.Time `json:"registered_at"`
	Address    string    `json:"address"` // full Address `
	Zone       int       `json:"zone"`    // todo
	MetaData   MetaData  `json:"meta_data"`
}

type RegistryClientI

type RegistryClientI interface {
	// Register self at this address/zone with registry
	Register(zone int, address string, meta MetaData) PeerResponse
	// GetZoneIds returns the zoneIds
	GetZoneIds() []int
	// GetZonePeers returns the addresses of zone peers
	GetZonePeers(zone int) PeerResponse
	// GetDetails returns all registered peers details
	GetDetails() []string
	GetPingMeta() map[string]PingMeta
	// contains filtered or unexported methods
}

func RegistryClient

func RegistryClient(serverAddress string) RegistryClientI

Jump to

Keyboard shortcuts

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