hyparview

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

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

Go to latest
Published: Oct 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Error chan error
}

type Config

type Config struct {
	Fanout          int `env:"HV_FANOUT"`
	PassiveViewSize int `env:"HV_PASSIVE_VIEW_SIZE"`
	ARWL            int `env:"HV_ARWL"`
	PRWL            int `env:"HV_PRWL"`
	ShuffleInterval int `env:"HV_SHUFFLE_INTERVAL"`
	Ka              int `env:"HV_K_A"`
	Kp              int `env:"HV_K_P"`
}

type ConnDownEvent

type ConnDownEvent struct {
	Conn transport.Conn
}

type HyParView

type HyParView struct {
	AllowAny bool
	// contains filtered or unexported fields
}

func NewHyParView

func NewHyParView(config Config, self data.Node, connManager transport.ConnManager, logger *log.Logger) (*HyParView, error)

func (*HyParView) AddClientMsgHandler

func (h *HyParView) AddClientMsgHandler(msgType data.MessageType, handler func(msg []byte, sender Peer))

func (*HyParView) GetPeers

func (h *HyParView) GetPeers(num int) []Peer

func (*HyParView) GetState

func (h *HyParView) GetState() any

func (*HyParView) Join

func (h *HyParView) Join(contactNodeID string, contactNodeAddress string) error

func (*HyParView) Leave

func (h *HyParView) Leave()

func (*HyParView) OnPeerDown

func (h *HyParView) OnPeerDown(handler func(peer Peer))

func (*HyParView) OnPeerUp

func (h *HyParView) OnPeerUp(handler func(peer Peer))

func (*HyParView) Self

func (h *HyParView) Self() data.Node

type JoinCmd

type JoinCmd struct {
	Cmd
	ContactID, ContactAddr string
}

type LeaveCmd

type LeaveCmd struct {
	Cmd
}

type MsgEvent

type MsgEvent struct {
	MsgBytes []byte
	Sender   transport.Conn
}

type Peer

type Peer struct {
	Node data.Node
	Conn transport.Conn
}

type PeerDownEvent

type PeerDownEvent struct {
	Peer Peer
}

type PeerList

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

type PeerUpEvent

type PeerUpEvent struct {
	Peer Peer
}

type ShuffleEvent

type ShuffleEvent struct{}

type State

type State struct {
	ActiveView  []string
	PassiveView []string
	Left        bool
}

Jump to

Keyboard shortcuts

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