agent

package
v0.0.0-...-99e8b4e Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

Agent participates in a brahm gossip network

func New

func New(logw io.Writer, cfg *Config) (a *Agent, err error)

New initializes the agent

func (*Agent) Emit

func (a *Agent) Emit(msg []byte, n, m int, to time.Duration) (ok bool)

Emit dissemates the message to N peers and succeeds unless less than m peers responded with success

func (*Agent) Join

func (a *Agent) Join(v brahms.View)

Join the network and starts the protocol

func (*Agent) Receive

func (a *Agent) Receive() (msg []byte, err error)

Receive will block until a new message can be read from the network

func (*Agent) Self

func (a *Agent) Self() brahms.Node

Self returns info about this agent as a node in the network

func (*Agent) Shutdown

func (a *Agent) Shutdown(ctx context.Context) (err error)

Shutdown attempts to close the agent gracefully

type Config

type Config struct {
	ListenAddr net.IP
	ListenPort uint16

	AdvertiseAddr net.IP
	AdvertisePort uint16

	ValidateTimeout     time.Duration
	UpdateTimeout       time.Duration
	InvalidationTimeout time.Duration
	ReceiveTimeout      time.Duration

	Params brahms.P
}

Config configures the agent

func LocalTestConfig

func LocalTestConfig() (cfg *Config)

LocalTestConfig returns a sensible default config for local testing

type Err

type Err struct {
	E  error
	Op string
}

Err tags errors encountered by the agent

func (Err) Error

func (e Err) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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