cmd

package
v0.0.0-...-24c9e8f Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProfileHttpServer

func NewProfileHttpServer(addr string)

func ProgramHandler

func ProgramHandler(LinkName string, obj *bpf.BpfObjects, debug bool, mode int) (*xdp.Program, *xdp.Socket)

New initializes the local node list

Types

type MyPacket

type MyPacket common.Packet

type NodeList

type NodeList struct {
	Amount  int   // Number of nodes to send synchronization information to at one time
	Cycle   int64 // Synchronization cycle (how many seconds to send list synchronization information to other nodes)
	Buffer  int   // UDP/TCP receive buffer size (determines how many requests the UDP/TCP listening service can process asynchronously)
	Size    int   // Maximum capacity of a single UDP/TCP heartbeat packet (in bytes)
	Timeout int64 // Expiry deletion limit for a single node (delete after how many seconds)

	SecretKey string // Cluster key, the keys of all nodes in the same cluster should be consistent

	Protocol   string // Network protocol used by the cluster connection, UDP or TCP, XDP(UDP based with ebpf feature) default is UDP
	ListenAddr string // Local UDP/TCP listening address, use this address to receive heartbeat packets from other nodes (usually 0.0.0.0 is sufficient)

	IsPrint bool // Whether to print list synchronization information to the console

	Program *bpf.BpfObjects       // bpf program
	Xsk     *xdp.Socket           // xdp socket
	Counter *common.AtomicCounter // bpf program key counter

	GatewayMAC string // gateway mac address
	// contains filtered or unexported fields
}

NodeList is a list of nodes

func (*NodeList) Get

func (nodeList *NodeList) Get() []common.Node

Get retrieves the local node list

func (*NodeList) GetMetadataHandler

func (nl *NodeList) GetMetadataHandler() http.HandlerFunc

Get metadata.

func (*NodeList) Join

func (nodeList *NodeList) Join()

Join joins the cluster

func (*NodeList) ListNodeHandler

func (nl *NodeList) ListNodeHandler() http.HandlerFunc

Dump node list.

func (*NodeList) New

func (nodeList *NodeList) New(localNode common.Node)

New initializes the local node list

func (*NodeList) Publish

func (nodeList *NodeList) Publish(newMetadata []byte)

Publish publishes new metadata information in the cluster

func (*NodeList) PublishHandler

func (nl *NodeList) PublishHandler() http.HandlerFunc

Publish data to all nodes.

func (*NodeList) Read

func (nodeList *NodeList) Read() []byte

Read retrieves the metadata information from the local node list

func (*NodeList) Set

func (nodeList *NodeList) Set(node common.Node)

Set adds other nodes to the local node list

func (*NodeList) SetNodeHandler

func (nl *NodeList) SetNodeHandler() http.HandlerFunc

Set new node

func (*NodeList) Start

func (nodeList *NodeList) Start()

Start restarts the broadcasting of heartbeat

func (*NodeList) Stop

func (nodeList *NodeList) Stop()

Stop stops the broadcasting of heartbeat

func (*NodeList) StopNodeHandler

func (nl *NodeList) StopNodeHandler() http.HandlerFunc

Stop a node.

Jump to

Keyboard shortcuts

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