replica

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: 23 Imported by: 0

Documentation

Overview

Package replica provides the required code for starting and running a replica and handling client requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The id of the replica.
	ID hotstuff.ID
	// The private key of the replica.
	PrivateKey consensus.PrivateKey
	// Controls whether TLS is used.
	TLS bool
	// The TLS certificate.
	Certificate *tls.Certificate
	// The root certificates trusted by the replica.
	RootCAs *x509.CertPool
	// The number of client commands that should be batched together in a block.
	BatchSize uint32
	// Options for the client server.
	ClientServerOptions []gorums.ServerOption
	// Options for the replica server.
	ReplicaServerOptions []gorums.ServerOption
	// Options for the replica manager.
	ManagerOptions []gorums.ManagerOption
}

Config configures a replica.

type Replica

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

Replica is a participant in the consensus protocol.

func New

func New(conf Config, builder consensus.Builder) (replica *Replica)

New returns a new replica.

func (*Replica) Close

func (srv *Replica) Close()

Close closes the connections and stops the servers used by the replica.

func (*Replica) Connect

func (srv *Replica) Connect(replicas *config.ReplicaConfig) error

Connect connects to the other replicas.

func (*Replica) GetHash

func (srv *Replica) GetHash() (b []byte)

GetHash returns the hash of all executed commands.

func (*Replica) Run

func (srv *Replica) Run(ctx context.Context)

Run runs the replica until the context is cancelled.

func (*Replica) Start

func (srv *Replica) Start()

Start runs the replica in a goroutine.

func (*Replica) StartServers

func (srv *Replica) StartServers(replicaListen, clientListen net.Listener)

StartServers starts the client and replica servers.

func (*Replica) Stop

func (srv *Replica) Stop()

Stop stops the replica and closes connections.

Jump to

Keyboard shortcuts

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