membership

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package membership provides Go types for dealing with various data formats used to advertise a server's presence using services like ZooKeeper or Etcd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TCPAddrFromServerSetEndpoint

func TCPAddrFromServerSetEndpoint(ep *ServerSetEndpoint) (*net.TCPAddr, error)

Types

type GRPC

type GRPC struct {
	Op       GRPCOperation `json:"Op"`
	Addr     string        `json:"Addr"`
	Metadata interface{}   `json:"Metadata,omitempty"`
}

func (*GRPC) AsJSON

func (grpc *GRPC) AsJSON() []byte

type GRPCOperation

type GRPCOperation uint8
const (
	GRPCOpAdd GRPCOperation = iota
	GRPCOpDelete

	GRPCOpInvalid = ^GRPCOperation(0)
)

func (GRPCOperation) GoString

func (op GRPCOperation) GoString() string

func (GRPCOperation) MarshalJSON

func (op GRPCOperation) MarshalJSON() ([]byte, error)

func (GRPCOperation) String

func (op GRPCOperation) String() string

func (*GRPCOperation) UnmarshalJSON

func (ptr *GRPCOperation) UnmarshalJSON(raw []byte) error

type Roxy

type Roxy struct {
	Ready           bool
	IP              net.IP
	Zone            string
	ServerName      string
	PrimaryPort     uint16
	AdditionalPorts map[string]uint16
	ShardID         *uint32
	Metadata        map[string]string
}

func (*Roxy) AsGRPC

func (r *Roxy) AsGRPC(namedPort string) (*GRPC, error)

func (*Roxy) AsRoxyJSON

func (r *Roxy) AsRoxyJSON() (*RoxyJSON, error)

func (*Roxy) AsServerSet

func (r *Roxy) AsServerSet() (*ServerSet, error)

func (*Roxy) FromGRPC

func (r *Roxy) FromGRPC(grpc *GRPC) error

func (*Roxy) FromRoxyJSON

func (r *Roxy) FromRoxyJSON(x *RoxyJSON) error

func (*Roxy) FromServerSet

func (r *Roxy) FromServerSet(ss *ServerSet) error

func (*Roxy) MarshalJSON

func (r *Roxy) MarshalJSON() ([]byte, error)

func (*Roxy) NamedAddr

func (r *Roxy) NamedAddr(namedPort string) *net.TCPAddr

func (*Roxy) NamedPorts

func (r *Roxy) NamedPorts() []string

func (*Roxy) Parse

func (r *Roxy) Parse(raw []byte) error

func (*Roxy) PrimaryAddr

func (r *Roxy) PrimaryAddr() *net.TCPAddr

func (*Roxy) UnmarshalJSON

func (r *Roxy) UnmarshalJSON(raw []byte) error

type RoxyJSON

type RoxyJSON struct {
	Ready           bool              `json:"ready"`
	IP              string            `json:"ip,omitempty"`
	Zone            string            `json:"zone,omitempty"`
	ServerName      string            `json:"serverName,omitempty"`
	PrimaryPort     uint16            `json:"primaryPort,omitempty"`
	AdditionalPorts map[string]uint16 `json:"additionalPorts,omitempty"`
	ShardID         *uint32           `json:"shardID,omitempty"`
	Metadata        map[string]string `json:"metadata,omitempty"`
}

type ServerSet

type ServerSet struct {
	ServiceEndpoint     *ServerSetEndpoint            `json:"serviceEndpoint"`
	AdditionalEndpoints map[string]*ServerSetEndpoint `json:"additionalEndpoints"`
	Status              ServerSetStatus               `json:"status"`
	ShardID             *int32                        `json:"shardId,omitempty"`
	Metadata            map[string]string             `json:"metadata,omitempty"`
}

func (*ServerSet) AsGRPC

func (ss *ServerSet) AsGRPC(namedPort string) *GRPC

func (*ServerSet) AsJSON

func (ss *ServerSet) AsJSON() []byte

func (*ServerSet) IsAlive

func (ss *ServerSet) IsAlive() bool

func (*ServerSet) TCPAddrForPort

func (ss *ServerSet) TCPAddrForPort(namedPort string) *net.TCPAddr

type ServerSetEndpoint

type ServerSetEndpoint struct {
	Host string `json:"host"`
	Port uint16 `json:"port"`
}

func ServerSetEndpointFromTCPAddr

func ServerSetEndpointFromTCPAddr(addr *net.TCPAddr) *ServerSetEndpoint

func (*ServerSetEndpoint) TCPAddr

func (ep *ServerSetEndpoint) TCPAddr() *net.TCPAddr

type ServerSetStatus

type ServerSetStatus uint8
const (
	StatusDead ServerSetStatus = iota
	StatusStarting
	StatusAlive
	StatusStopping
	StatusStopped
	StatusWarning
)

func (ServerSetStatus) GoString

func (st ServerSetStatus) GoString() string

func (ServerSetStatus) MarshalJSON

func (st ServerSetStatus) MarshalJSON() ([]byte, error)

func (ServerSetStatus) String

func (st ServerSetStatus) String() string

func (*ServerSetStatus) UnmarshalJSON

func (st *ServerSetStatus) UnmarshalJSON(raw []byte) error

Jump to

Keyboard shortcuts

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