gorums

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 15 Imported by: 1

Documentation

Overview

Package gorums implements a networking backend for HotStuff using the gorums framework.

In particular, this package implements the Configuration and Replica interfaces which are used to send messages. This package also receives messages from other replicas and posts them to the event loop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config holds information about the current configuration of replicas that participate in the protocol, and some information about the local replica. It also provides methods to send messages to the other replicas.

func NewConfig

func NewConfig(id hotstuff.ID, creds credentials.TransportCredentials, opts ...gorums.ManagerOption) *Config

NewConfig creates a new configuration.

func (*Config) Close

func (cfg *Config) Close()

Close closes all connections made by this configuration.

func (*Config) Connect

func (cfg *Config) Connect(replicaCfg *config.ReplicaConfig) (err error)

Connect opens connections to the replicas in the configuration.

func (*Config) Fetch

func (cfg *Config) Fetch(ctx context.Context, hash consensus.Hash) (*consensus.Block, bool)

Fetch requests a block from all the replicas in the configuration

func (*Config) InitConsensusModule added in v0.3.0

func (cfg *Config) InitConsensusModule(mods *consensus.Modules, _ *consensus.OptionsBuilder)

InitConsensusModule gives the module a reference to the Modules object. It also allows the module to set module options using the OptionsBuilder.

func (*Config) Len

func (cfg *Config) Len() int

Len returns the number of replicas in the configuration.

func (*Config) Propose

func (cfg *Config) Propose(proposal consensus.ProposeMsg)

Propose sends the block to all replicas in the configuration

func (*Config) QuorumSize

func (cfg *Config) QuorumSize() int

QuorumSize returns the size of a quorum

func (*Config) Replica

func (cfg *Config) Replica(id hotstuff.ID) (replica consensus.Replica, ok bool)

Replica returns a replica if it is present in the configuration.

func (*Config) Replicas

func (cfg *Config) Replicas() map[hotstuff.ID]consensus.Replica

Replicas returns all of the replicas in the configuration.

func (*Config) Timeout added in v0.3.0

func (cfg *Config) Timeout(msg consensus.TimeoutMsg)

Timeout sends the timeout message to all replicas.

type Server

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

Server is the server-side of the gorums backend. It is responsible for calling handler methods on the consensus instance.

func NewServer

func NewServer(opts ...gorums.ServerOption) *Server

NewServer creates a new Server.

func (*Server) Fetch

func (srv *Server) Fetch(ctx gorums.ServerCtx, pb *hotstuffpb.BlockHash) (*hotstuffpb.Block, error)

Fetch handles an incoming fetch request.

func (*Server) InitConsensusModule added in v0.3.0

func (srv *Server) InitConsensusModule(mods *consensus.Modules, _ *consensus.OptionsBuilder)

InitConsensusModule gives the module a reference to the Modules object. It also allows the module to set module options using the OptionsBuilder.

func (*Server) NewView

func (srv *Server) NewView(ctx gorums.ServerCtx, msg *hotstuffpb.SyncInfo)

NewView handles the leader's response to receiving a NewView rpc from a replica.

func (*Server) Propose

func (srv *Server) Propose(ctx gorums.ServerCtx, proposal *hotstuffpb.Proposal)

Propose handles a replica's response to the Propose QC from the leader.

func (*Server) Start

func (srv *Server) Start(addr string) error

Start creates a listener on the configured address and starts the server.

func (*Server) StartOnListener

func (srv *Server) StartOnListener(listener net.Listener)

StartOnListener starts the server on the given listener.

func (*Server) Stop

func (srv *Server) Stop()

Stop stops the server.

func (*Server) Timeout added in v0.3.0

func (srv *Server) Timeout(ctx gorums.ServerCtx, msg *hotstuffpb.TimeoutMsg)

Timeout handles an incoming TimeoutMsg.

func (*Server) Vote

func (srv *Server) Vote(ctx gorums.ServerCtx, cert *hotstuffpb.PartialCert)

Vote handles an incoming vote message.

Jump to

Keyboard shortcuts

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