bmmc

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// NOCALLBACK is callback type for messages without callback
	NOCALLBACK = callback.NOCALLBACK
)

Variables

This section is empty.

Functions

func RunWithSpec added in v0.1.3

func RunWithSpec(retries int,
	noPeers int,
	loss float64,
	beta float64,
	cbRegistry map[string]func(interface{}, *log.Logger) error,
	cbType string,
	timeout time.Duration) error

RunWithSpec runs the protocol with given specification nolint:gocyclo

Types

type Bmmc added in v0.1.2

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

Bmmc is the protocol

func New

func New(cfg *Config) (*Bmmc, error)

New creates a new instance for the protocol

func (*Bmmc) AddMessage added in v0.1.2

func (b *Bmmc) AddMessage(msg interface{}, callbackType string) error

AddMessage adds new message in messages buffer.

func (*Bmmc) AddPeer added in v0.1.6

func (b *Bmmc) AddPeer(addr, port string) error

AddPeer adds new peer in peers buffer

func (*Bmmc) GetMessages added in v0.1.2

func (b *Bmmc) GetMessages() []interface{}

GetMessages returns a slice with all messages from messages buffer

func (*Bmmc) RemovePeer added in v0.1.6

func (b *Bmmc) RemovePeer(addr, port string) error

RemovePeer removes given peer from peers buffer

func (*Bmmc) Start added in v0.1.2

func (b *Bmmc) Start() error

Start starts the gossip server and the http server

func (*Bmmc) Stop added in v0.1.2

func (b *Bmmc) Stop()

Stop stops the gossip server and the http server

type Config

type Config struct {
	// Addr is HTTP address for node which runs gossip and http servers
	// Required
	Addr string
	// Port is HTTP port for node which runs gossip  and http servers
	// Required
	Port string
	// Beta is the expected fanout for gossip rounds
	// Optional
	Beta float64
	// Logger
	// Optional
	Logger *log.Logger
	// Callbacks funtions
	// Optional
	Callbacks map[string]func(interface{}, *log.Logger) error
	// Gossip round duration
	// Optional
	RoundDuration time.Duration
}

Config is the config for the protocol

Jump to

Keyboard shortcuts

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