gossip

package module
v0.0.0-...-6c51fee Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 9 Imported by: 0

README

gossip

gossip协议实现(仿照memberlist) memberlist是go语言开发的,基于Gossip协议来传播消息,用来管理分布式集群内节点发现、 节点失效探测、节点列表的软件包。 gossip 流言蜚语

Documentation

Index

Constants

View Source
const (
	StateSuspect // 可疑的
	StateDead
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name             string // Node name
	BindAddr         string // Bindding Address
	UDPPort          int
	TCPPort          int
	TCPTimeout       time.Duration
	IndirectChecks   int           // 要使用的间接检查次数
	RetransmitMult   int           // 重传(Retransmits) = RetransmitMult * log(N+1)
	SuspicionMult    int           // 怀疑时间(Suspicion time) = SuspcicionMult * log(N+1) * Interval
	PushPullInterval time.Duration // Push/Pull update 间隔
	RTT              time.Duration // 99% precentile of round-trip-time
	ProbeInterval    time.Duration // 故障探测间隔长度

	GossipNodes    int           // 每个 GossipInterval 要八卦的节点数
	GossipInterval time.Duration // 非搭载消息的 Gossip 间隔(仅当 GossipNodes > 0 时)

	JoinCh  chan<- *Node // 用于做新增node的时候,作为外部注册通知处理
	LeaveCh chan<- *Node // 用于做对去除一个node的时候,做为外部注册通知处理
}

func DefaultConfig

func DefaultConfig() *Config

type Memberlist

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

func Create

func Create(conf *Config) (*Memberlist, error)

type Node

type Node struct {
	Name string
	Addr net.IP
}

type NodeState

type NodeState struct {
	Node
	Incarnation uint32
	State       int
	StateChange time.Time
}

Jump to

Keyboard shortcuts

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