gossip

package
v0.0.0-...-d211fd2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterMeshAPIServerData

type ClusterMeshAPIServerData struct {
	ClusterName string
}

type Delegate

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

func NewDelegate

func NewDelegate(logger *zap.Logger, meshState *state.ClusterMeshState) *Delegate

func (*Delegate) GetBroadcasts

func (d *Delegate) GetBroadcasts(overhead, limit int) [][]byte

func (*Delegate) LocalState

func (d *Delegate) LocalState(join bool) []byte

func (*Delegate) MergeRemoteState

func (d *Delegate) MergeRemoteState(buf []byte, join bool)

func (*Delegate) NodeMeta

func (d *Delegate) NodeMeta(limit int) []byte

func (*Delegate) NotifyJoin

func (e *Delegate) NotifyJoin(node *memberlist.Node)

func (*Delegate) NotifyLeave

func (e *Delegate) NotifyLeave(node *memberlist.Node)

func (*Delegate) NotifyMsg

func (d *Delegate) NotifyMsg(msg []byte)

func (*Delegate) NotifyUpdate

func (e *Delegate) NotifyUpdate(node *memberlist.Node)

type NodeMeta

type NodeMeta struct {
	ClusterName string
}

func ParseNodeMeta

func ParseNodeMeta(data []byte) (NodeMeta, error)

func (NodeMeta) Bytes

func (m NodeMeta) Bytes() []byte

type Server

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

func NewServer

func NewServer(opts ServerOptions, logger *zap.Logger, meshState *state.ClusterMeshState, clientSet *kubernetes.Clientset) *Server

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

type ServerOptions

type ServerOptions struct {
	ClusterName         string
	GossipNodeName      string
	GossipAdvertiseAddr string
	GossipAdvertisePort int
	GossipBindAddr      string
	GossipPort          int
	GossipJoinAddresses []string
}

type TCPTransport

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

Copied and edited from distributed systems kit from grafana https://github.com/grafana/dskit/blob/main/kv/memberlist/tcp_transport.go TCPTransport is a memberlist.Transport implementation that uses TCP for both packet and stream operations ("packet" and "stream" are terms used by memberlist). It uses a new TCP connections for each operation. There is no connection reuse.

func NewTCPTransport

func NewTCPTransport(config TCPTransportConfig, logger *zap.Logger) (*TCPTransport, error)

NewTCPTransport returns a new tcp-based transport with the given configuration. On success all the network listeners will be created and listening.

func (*TCPTransport) DialTimeout

func (t *TCPTransport) DialTimeout(addr string, timeout time.Duration) (net.Conn, error)

DialTimeout is used to create a connection that allows memberlist to perform two-way communication with a peer.

func (*TCPTransport) FinalAdvertiseAddr

func (t *TCPTransport) FinalAdvertiseAddr(ip string, port int) (net.IP, int, error)

FinalAdvertiseAddr is given the user's configured values (which might be empty) and returns the desired IP and port to advertise to the rest of the cluster. (Copied from memberlist' net_transport.go)

func (*TCPTransport) GetAutoBindPort

func (t *TCPTransport) GetAutoBindPort() int

GetAutoBindPort returns the bind port that was automatically given by the kernel, if a bind port of 0 was given.

func (*TCPTransport) PacketCh

func (t *TCPTransport) PacketCh() <-chan *memberlist.Packet

PacketCh returns a channel that can be read to receive incoming packets from other peers.

func (*TCPTransport) Shutdown

func (t *TCPTransport) Shutdown() error

Shutdown is called when memberlist is shutting down; this gives the transport a chance to clean up any listeners.

func (*TCPTransport) StreamCh

func (t *TCPTransport) StreamCh() <-chan net.Conn

StreamCh returns a channel that can be read to handle incoming stream connections from other peers.

func (*TCPTransport) WriteTo

func (t *TCPTransport) WriteTo(b []byte, addr string) (time.Time, error)

WriteTo is a packet-oriented interface that fires off the given payload to the given address.

type TCPTransportConfig

type TCPTransportConfig struct {
	BindAddrs          []string
	BindPort           int
	PacketDialTimeout  time.Duration
	PacketWriteTimeout time.Duration
	TransportDebug     bool
}

Jump to

Keyboard shortcuts

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