candidate

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(b *bytes.Buffer, cMsg *Candidate) error

func Encode

func Encode(b *bytes.Buffer, cm *Candidate) error

Types

type Broker

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

Broker is the entry point for the candidate component. It manages an in-memory store of `Candidate` messages, and allows for the fetching of these messages through the `RPCBus`. It listens for incoming `Candidate` messages and puts them on the store. In case an internal component requests an absent `Candidate` message, the Broker can make a `GetCandidate` request to the rest of the network, and will attempt to provide the requesting component with it's needed `Candidate`.

func NewBroker

func NewBroker(broker eventbus.Broker, rpcBus *rpcbus.RPCBus) *Broker

NewBroker returns an initialized Broker struct. It will still need to be started by calling `Listen`.

func (Broker) Clear

func (c Broker) Clear(round uint64) int

Clear removes all candidate messages from or before a given round. Returns the amount of messages deleted.

func (*Broker) Listen

func (b *Broker) Listen()

Listen for incoming `Candidate` messages, and internal requests. Should be run in a goroutine.

type Candidate

type Candidate struct {
	*block.Block
	*block.Certificate
}

func NewCandidate

func NewCandidate() *Candidate

Jump to

Keyboard shortcuts

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