Documentation
¶
Overview ¶
Package backend implements the networking backend for hotstuff using the Gorums framework.
Index ¶
- func GetPeerIDFromContext(ctx context.Context, cfg modules.Configuration) (hotstuff.ID, error)
- type Config
- func (cfg *Config) Close()
- func (cfg *Config) Connect(replicas []ReplicaInfo) (err error)
- func (cfg *Config) Fetch(ctx context.Context, hash hotstuff.Hash) (*hotstuff.Block, bool)
- func (cfg *Config) GetRawConfiguration() gorums.RawConfiguration
- func (cfg *Config) InitModule(mods *modules.Core)
- func (cfg *Config) Len() int
- func (cfg *Config) Propose(proposal hotstuff.ProposeMsg)
- func (cfg *Config) QuorumSize() int
- func (cfg *Config) Replica(id hotstuff.ID) (replica modules.Replica, ok bool)
- func (cfg *Config) Replicas() map[hotstuff.ID]modules.Replica
- func (cfg *Config) SubConfig(ids []hotstuff.ID) (sub modules.Configuration, err error)
- func (cfg *Config) Timeout(msg hotstuff.TimeoutMsg)
- type ConnectedEvent
- type Replica
- type ReplicaInfo
- type Server
- type ServerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPeerIDFromContext ¶
GetPeerIDFromContext extracts the ID of the peer from the context.
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(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(replicas []ReplicaInfo) (err error)
Connect opens connections to the replicas in the configuration.
func (*Config) GetRawConfiguration ¶
func (cfg *Config) GetRawConfiguration() gorums.RawConfiguration
GetRawConfiguration returns the underlying gorums RawConfiguration.
func (*Config) InitModule ¶
InitModule initializes the configuration.
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 hotstuff.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) SubConfig ¶
SubConfig returns a subconfiguration containing the replicas specified in the ids slice.
func (*Config) Timeout ¶
func (cfg *Config) Timeout(msg hotstuff.TimeoutMsg)
Timeout sends the timeout message to all replicas.
type ConnectedEvent ¶
type ConnectedEvent struct{}
ConnectedEvent is sent when the configuration has connected to the other replicas.
type Replica ¶
type Replica struct {
// contains filtered or unexported fields
}
Replica provides methods used by hotstuff to send messages to replicas.
func (*Replica) Vote ¶
func (r *Replica) Vote(cert hotstuff.PartialCert)
Vote sends the partial certificate to the other replica.
type ReplicaInfo ¶
ReplicaInfo holds information about a replica.
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 (*Server) GetGorumsServer ¶
GetGorumsServer returns the underlying gorums Server.
func (*Server) InitModule ¶
InitModule initializes the Server.
func (*Server) StartOnListener ¶
StartOnListener starts the server with the given listener.
type ServerOptions ¶
type ServerOptions func(*backendOptions)
ServerOptions is a function for configuring the Server.
func WithGorumsServerOptions ¶
func WithGorumsServerOptions(opts ...gorums.ServerOption) ServerOptions
WithGorumsServerOptions sets the gorums server options.
func WithLatencies ¶
func WithLatencies(id hotstuff.ID, locations []string) ServerOptions
WithLatencies sets the locations assigned to the replicas and constructs the corresponding latency matrix.