checkpoint

package
v0.0.0-...-7cd50c7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpointer

type Checkpointer interface {

	// Initializes the Checkpointer and attaches a Manager to it.
	// The Manager informs the Checkpointer about the sequence numbers at which a checkpoint should occur.
	// AttachManager must be called before the Manager is started, so the Checkpointer does not miss any checkpoints.
	// Init() must be called before the Manager is started, so the Orderer does not miss any checkpoints.
	// Init() must be called before Strat() is called.
	// After Init() returns, the Checkpointer mus be ready to process incoming messages, but must not send any itself
	// (sending messages only can start after the call to Start()).
	Init(mngr manager.Manager)

	// Message handler function. To be assigned to the messenger.CheckpointMsgHandler variable, which the messenger
	// calls on reception of a message belonging to the checkpointing subprotocol.
	HandleMessage(checkpoint *pb.CheckpointMsg, senderID int32)

	// Satrts the Checkpointer. Before starting the Checkpointer, it must be attached to the Manager and its message
	// handler must be registered with the messanger.
	// Meant to be run as a separate goroutine.
	// Decrements the passed wait group on termination.
	Start(group *sync.WaitGroup)

	// Returns all checkpoints that are not stable yet.
	GetPendingCheckpoints() []*pb.CheckpointMsg
}

The Checkpointer is responsible for running the checkpointing protocol. Whenever instructed by the Manager, the Checkpointer creates a new instance of the checkpointing protocol.

type SigningCheckpointer

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

Represents a simple implementation of a Checkpointer. Whenever the local log reaches a checkpoint, SigningCheckpointer sends a signed message to all other nodes containing the Merkle tree root of the batches between this and the last checkpoint. When a node receives a quorum of such messages, it creates a stable checkpoint.

func NewSigningCheckpointer

func NewSigningCheckpointer() *SigningCheckpointer

Returns a new initialized SimpleCheckpointer.

func (*SigningCheckpointer) GetPendingCheckpoints

func (c *SigningCheckpointer) GetPendingCheckpoints() []*pb.CheckpointMsg

func (*SigningCheckpointer) HandleMessage

func (c *SigningCheckpointer) HandleMessage(msg *pb.CheckpointMsg, senderID int32)

Handles a message received by the messenger (this method is registered with the messanger as the message handler callback). It only feeds all messages to a channel for further sequential processing.

func (*SigningCheckpointer) Init

func (c *SigningCheckpointer) Init(mngr manager.Manager)

Initializes SimpleCheckpointer. Subscribes to the Manager that issues sequence numbers at which SimpleCheckpointer will trigger a new instance of the checkpointing protocol.

func (*SigningCheckpointer) Start

func (c *SigningCheckpointer) Start(wg *sync.WaitGroup)

Starts SimpleCheckpointer. After the call to Start(), SimpleCheckpointer starts: - Processing incoming messages - Observing the log and triggering new instances of the checkpointing protocol when instruted by the Manager Meant to be run as a separate goroutine. Decrements the provided wait group when done.

type SimpleCheckpointer

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

Represents a simple implementation of a Checkpointer. Whenever the local log reaches a checkpoint, SimpleCheckpointer sends a message to all other nodes. When a node receives a quorum of such messages, it creates a stable checkpoint.

func NewSimpleCheckpointer

func NewSimpleCheckpointer() *SimpleCheckpointer

Returns a new initialized SimpleCheckpointer.

func (*SimpleCheckpointer) GetPendingCheckpoints

func (c *SimpleCheckpointer) GetPendingCheckpoints() []*pb.CheckpointMsg

func (*SimpleCheckpointer) HandleMessage

func (c *SimpleCheckpointer) HandleMessage(msg *pb.CheckpointMsg, senderID int32)

Handles a message received by the messenger (this method is registered with the messanger as the message handler callback). It only feeds all messages to a channel for further sequential processing.

func (*SimpleCheckpointer) Init

func (c *SimpleCheckpointer) Init(mngr manager.Manager)

Initializes SimpleCheckpointer. Subscribes to the Manager that issues sequence numbers at which SimpleCheckpointer will trigger a new instance of the checkpointing protocol.

func (*SimpleCheckpointer) Start

func (c *SimpleCheckpointer) Start(wg *sync.WaitGroup)

Starts SimpleCheckpointer. After the call to Start(), SimpleCheckpointer starts: - Processing incoming messages - Observing the log and triggering new instances of the checkpointing protocol when instruted by the Manager Meant to be run as a separate goroutine. Decrements the provided wait group when done.

Jump to

Keyboard shortcuts

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