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 ¶
- type Config
- func (cfg *Config) Close()
- func (cfg *Config) Connect(replicaCfg *config.ReplicaConfig) (err error)
- func (cfg *Config) Fetch(ctx context.Context, hash consensus.Hash) (*consensus.Block, bool)
- func (cfg *Config) InitConsensusModule(mods *consensus.Modules, _ *consensus.OptionsBuilder)
- func (cfg *Config) Len() int
- func (cfg *Config) Propose(proposal consensus.ProposeMsg)
- func (cfg *Config) QuorumSize() int
- func (cfg *Config) Replica(id hotstuff.ID) (replica consensus.Replica, ok bool)
- func (cfg *Config) Replicas() map[hotstuff.ID]consensus.Replica
- func (cfg *Config) Timeout(msg consensus.TimeoutMsg)
- type Server
- func (srv *Server) Fetch(ctx gorums.ServerCtx, pb *hotstuffpb.BlockHash) (*hotstuffpb.Block, error)
- func (srv *Server) InitConsensusModule(mods *consensus.Modules, _ *consensus.OptionsBuilder)
- func (srv *Server) NewView(ctx gorums.ServerCtx, msg *hotstuffpb.SyncInfo)
- func (srv *Server) Propose(ctx gorums.ServerCtx, proposal *hotstuffpb.Proposal)
- func (srv *Server) Start(addr string) error
- func (srv *Server) StartOnListener(listener net.Listener)
- func (srv *Server) Stop()
- func (srv *Server) Timeout(ctx gorums.ServerCtx, msg *hotstuffpb.TimeoutMsg)
- func (srv *Server) Vote(ctx gorums.ServerCtx, cert *hotstuffpb.PartialCert)
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) 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) Propose ¶
func (cfg *Config) Propose(proposal consensus.ProposeMsg)
Propose sends the block to all replicas in the configuration
func (*Config) QuorumSize ¶
QuorumSize returns the size of a quorum
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) StartOnListener ¶
StartOnListener starts the server on the given listener.
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.