replica

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 21 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 hotstuff.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
	// Location names of all replicas.
	Locations []string
}

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 modules.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 []backend.ReplicaInfo) error

Connect connects to the other replicas.

func (*Replica) GetCmdCount added in v0.5.0

func (srv *Replica) GetCmdCount() (c uint32)

GetCmdCount returns the count of all executed commands.

func (*Replica) GetHash

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

GetHash returns the hash of all executed commands.

func (*Replica) Modules added in v0.5.0

func (srv *Replica) Modules() *modules.Core

Modules returns the Modules object of this replica.

func (*Replica) Run

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

Run runs the replica until the context is canceled.

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