delago.dedis.ch/dela/mino/gossip Index | Files

package gossip

import "go.dedis.ch/dela/mino/gossip"

Package gossip defines an abstraction to gossip messages to a defined set of participants.

Documentation Last Review: 06.10.2020

Index

Types

type Actor

type Actor interface {
	// SetPlayers changes the list of participants that the actor should send
	// rumors to. It is up to the implementation to send to only a subset.
	SetPlayers(mino.Players)

	// Add adds the rumor in the set of rumors that must be spread to the
	// participants.
	Add(rumor Rumor) error

	// Close cleans any resource used by the actor.
	Close() error
}

Actor is an actor that can send rumor to a gossip network.

type Flat

type Flat struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Flat is an implementation of a message passing protocol that is using a flat communication approach by sending a rumor to all the known participants.

- implements gossip.Gossiper

func NewFlat

func NewFlat(m mino.Mino, f serde.Factory) *Flat

NewFlat creates a new instance of a flat gossip protocol.

func (*Flat) Listen

func (flat *Flat) Listen() (Actor, error)

Listen implements gossip.Gossiper. It creates the RPC and starts to listen for incoming rumors while spreading its own ones.

func (*Flat) Rumors

func (flat *Flat) Rumors() <-chan Rumor

Rumors implements gossip.Gossiper. It returns the channel that is populated with new rumors.

type Gossiper

type Gossiper interface {
	// Rumors returns a channel populated with the new rumors.
	Rumors() <-chan Rumor

	// Listen starts to listen for rumors and returns a gossip actor.
	Listen() (Actor, error)
}

Gossiper is an abstraction of a message passing protocol that uses internally a gossip protocol.

type Rumor

type Rumor interface {
	serde.Message

	// GetID returns the unique identifier of the rumor.
	GetID() []byte
}

Rumor is the message that must be gossiped through the network. It is using the identifier as a unique way to differentiate all the rumors.

Source Files

flat.go mod.go

Version
v0.1.0 (latest)
Published
Apr 10, 2024
Platform
linux/amd64
Imports
8 packages
Last checked
1 month ago

Tools for package owners.