Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockIterator ¶ added in v0.2.0
type BlockStorage ¶ added in v0.2.0
type BlockStorage interface {
Blockchain(shard Shard) process.Blockchain
LatestBlock(shard Shard) block.Block
LatestBaseBlock(shard Shard) block.Block
}
BlockStorage extends the `process.Blockchain` interface with the functionality to load the last committed `block.Standard`, and the last committed `block.Base`.
type Broadcaster ¶ added in v0.2.0
A Broadcaster is used to send signed, shard-specific, Messages to one or all Replicas in the network.
type Message ¶ added in v0.2.0
A Message sent/received by a Replica is composed of a Shard and the underlying `process.Message` data. It is expected that a Replica will sign the underlying `process.Message` data before sending the Message.
type Options ¶ added in v0.2.0
type Options struct {
// Logging
Logger logrus.FieldLogger
// Timeout options for proposing, prevoting, and precommiting
BackOffExp float64
BackOffBase time.Duration
BackOffMax time.Duration
}
Options define a set of properties that can be used to parameterise the Replica and its behaviour.
type ProcessStorage ¶ added in v0.2.0
type ProcessStorage interface {
SaveState(state *process.State, shard Shard)
RestoreState(state *process.State, shard Shard)
}
ProcessStorage saves and restores `process.State` to persistent memory. This guarantees that in the event of an unexpected shutdown, the Replica will only drop the `process.Message` that was currently being handling.
type Replica ¶
type Replica struct {
// contains filtered or unexported fields
}
A Replica represents one Process in a replicated state machine that is bound to a specific Shard. It signs Messages before sending them to other Replicas, and verifies Messages before accepting them from other Replicas.
func New ¶
func New(options Options, pStorage ProcessStorage, blockStorage BlockStorage, blockIterator BlockIterator, validator Validator, observer Observer, broadcaster Broadcaster, shard Shard, privKey ecdsa.PrivateKey) Replica
func (*Replica) HandleMessage ¶ added in v0.2.0
func (*Replica) Rebase ¶ added in v0.2.0
func (replica *Replica) Rebase(sigs id.Signatories)