gorums

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 15 Imported by: 1

Documentation

Overview

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

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(replicaCfg config.ReplicaConfig) *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(connectTimeout time.Duration) error

Connect opens connections to the replicas in the configuration.

func (*Config) Fetch

func (cfg *Config) Fetch(ctx context.Context, hash hotstuff.Hash)

Fetch requests a block from all the replicas in the configuration

func (*Config) ID

func (cfg *Config) ID() hotstuff.ID

ID returns the id of this replica.

func (*Config) Len

func (cfg *Config) Len() int

Len returns the number of replicas in the configuration.

func (*Config) PrivateKey

func (cfg *Config) PrivateKey() hotstuff.PrivateKey

PrivateKey returns the id of this replica.

func (*Config) Propose

func (cfg *Config) Propose(block *hotstuff.Block)

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 hotstuff.Replica, ok bool)

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

func (*Config) Replicas

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

Replicas returns all of the replicas in the configuration.

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(replicaConfig config.ReplicaConfig) *Server

NewServer creates a new Server.

func (*Server) Deliver

func (srv *Server) Deliver(_ context.Context, block *proto.Block)

Deliver handles an incoming deliver message.

func (*Server) Fetch

func (srv *Server) Fetch(ctx context.Context, pb *proto.BlockHash)

Fetch handles an incoming fetch request.

func (*Server) NewView

func (srv *Server) NewView(ctx context.Context, msg *proto.NewViewMsg)

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

func (*Server) Propose

func (srv *Server) Propose(ctx context.Context, block *proto.Block)

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

func (*Server) Start

func (srv *Server) Start(hs hotstuff.Consensus) error

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

func (*Server) StartOnListener

func (srv *Server) StartOnListener(hs hotstuff.Consensus, listener net.Listener)

StartOnListener starts the server on the given listener.

func (*Server) Stop

func (srv *Server) Stop()

Stop stops the server.

func (*Server) Vote

func (srv *Server) Vote(_ context.Context, cert *proto.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