Categorygithub.com/treeforest/gossip
modulepackage
0.2.4
Repository: https://github.com/treeforest/gossip.git
Documentation: pkg.go.dev

# README

gossip

Implementation of gossip based on pull mechanism.

Usage

For usage details, please refer to the example folder.

User must implement interface Delegate

  • Delegate
type Delegate interface {
	// NotifyMsg notify user massage
	NotifyMsg(msg []byte)

	// GetBroadcasts gossip user messages
	GetBroadcasts() (data [][]byte)

	// GetPullRequest return pull request
	GetPullRequest() (req []byte)

	// ProcessPullRequest process pull request and return pull response
	ProcessPullRequest(req []byte) (resp []byte)

	// ProcessPullResponse process pull response
	ProcessPullResponse(resp []byte)
}

User selectable interface EventDelegate

  • EventDelegate
type EventDelegate interface {
	// NotifyJoin notify membership join
	NotifyJoin(member pb.Membership)

	// NotifyLeave notify membership leave
	NotifyLeave(member pb.Membership)

	// NotifyUpdate notify membership metadata update
	NotifyUpdate(member pb.Membership)
}

Pull Model

pull.png

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
NewPubSub creates a new PubSub with an empty set of subscriptions.
NewSet returns a new set.

# Variables

No description provided by the author

# Structs

No description provided by the author
LRUCache 消息id的过期+lru缓存.
PubSub defines a struct that one can use to: - publish items to a topic to multiple subscribers - and subscribe to items from a topic The subscriptions have a TTL and are cleaned when it passes.
No description provided by the author
Set is a generic and thread-safe set container.

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Subscription defines a subscription to a topic that can be used to receive publishes on.