events

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppRestoreState

func AppRestoreState(destModule t.ModuleID, checkpoint *checkpointpb.StableCheckpoint) *eventpb.Event

AppRestoreState returns an event representing the protocol module asking the application for restoring its state from the snapshot.

func AppSnapshotRequest

func AppSnapshotRequest(destModule t.ModuleID, replyTo t.ModuleID) *eventpb.Event

AppSnapshotRequest returns an event representing the protocol module asking the application for a state snapshot.

func AppSnapshotResponse

func AppSnapshotResponse(
	destModule t.ModuleID,
	appData []byte,
) *eventpb.Event

AppSnapshotResponse returns an event representing the application making a snapshot of its state. appData is the serialized application state (the snapshot itself) and origin is the origin of the corresponding AppSnapshotRequest.

func ClientRequest

func ClientRequest(clientID t.ClientID, reqNo t.ReqNo, data []byte) *requestpb.Request

ClientRequest returns an event representing the reception of a request from a client.

func DeliverCert

func DeliverCert(destModule t.ModuleID, sn t.SeqNr, cert *availabilitypb.Cert) *eventpb.Event

Deliver returns an event of delivering a request batch to the application in sequence number order.

func EpochConfig

func EpochConfig(
	epochNr t.EpochNr,
	firstSn t.SeqNr,
	length int,
	memberships []map[t.NodeID]t.NodeAddress,
) *commonpb.EpochConfig

EpochConfig represents the configuration of the system during one epoch

func Factory

func Factory(destModule t.ModuleID, evt *factorymodulepb.Factory) *eventpb.Event

func HashRequest

func HashRequest(destModule t.ModuleID, data [][][]byte, origin *eventpb.HashOrigin) *eventpb.Event

HashRequest returns an event representing a request to the hashing module for computing hashes of data. For each object to be hashed the data argument contains a slice of byte slices representing it (thus [][][]byte). The origin is an object used to maintain the context for the requesting module and will be included in the HashResult produced by the hashing module.

func HashResult

func HashResult(destModule t.ModuleID, digests [][]byte, origin *eventpb.HashOrigin) *eventpb.Event

HashResult returns an event representing the computation of hashes by the hashing module. It contains the computed digests and the HashOrigin, an object used to maintain the context for the requesting module, i.e., information about what to do with the contained digest.

func HashedRequest

func HashedRequest(request *requestpb.Request, digest []byte) *requestpb.HashedRequest

func Init

func Init(destModule t.ModuleID) *eventpb.Event

Init returns an event instructing a module to initialize. This event is the first to be applied to a module after applying all events from the WAL.

func MessageReceived

func MessageReceived(destModule t.ModuleID, from t.NodeID, message *messagepb.Message) *eventpb.Event

MessageReceived returns an event representing the reception of a message from another node. The from parameter is the ID of the node the message was received from.

func NewClientRequests

func NewClientRequests(destModule t.ModuleID, requests []*requestpb.Request) *eventpb.Event

NewClientRequests returns an event representing the reception of new requests from clients.

func NewConfig

func NewConfig(destModule t.ModuleID, epochNr t.EpochNr, membership map[t.NodeID]t.NodeAddress) *eventpb.Event

func NewEpoch

func NewEpoch(destModule t.ModuleID, epochNr t.EpochNr) *eventpb.Event

func NodeSigsVerified

func NodeSigsVerified(
	destModule t.ModuleID,
	valid []bool,
	errors []string,
	nodeIDs []t.NodeID,
	origin *eventpb.SigVerOrigin,
	allOk bool,
) *eventpb.Event

NodeSigsVerified returns an event representing the result of the verification of multiple nodes' signatures by the crypto module. It contains the results of the verifications (as boolean values and errors produced by the Crypto module if the verification failed) and the SigVerOrigin, an object used to maintain the context for the requesting module, i.e., information about what to do with the results of the signature verification. The allOK argument must be set to true if the valid argument only contains true values.

func Redirect

func Redirect(event *eventpb.Event, destination t.ModuleID) *eventpb.Event

func SendMessage

func SendMessage(destModule t.ModuleID, message *messagepb.Message, destinations []t.NodeID) *eventpb.Event

SendMessage returns an event of sending the message message to destinations. destinations is a slice of replica IDs that will be translated to actual addresses later.

func SignRequest

func SignRequest(destModule t.ModuleID, data [][]byte, origin *eventpb.SignOrigin) *eventpb.Event

SignRequest returns an event representing a request to the crypto module for computing the signature over data. The origin is an object used to maintain the context for the requesting module and will be included in the SignResult produced by the crypto module.

func SignResult

func SignResult(destModule t.ModuleID, signature []byte, origin *eventpb.SignOrigin) *eventpb.Event

SignResult returns an event representing the computation of a signature by the crypto module. It contains the computed signature and the SignOrigin, an object used to maintain the context for the requesting module, i.e., information about what to do with the contained signature.

func TestingString

func TestingString(dest t.ModuleID, s string) *eventpb.Event

func TestingUint

func TestingUint(dest t.ModuleID, u uint64) *eventpb.Event

func TimerDelay

func TimerDelay(destModule t.ModuleID, events []*eventpb.Event, delay t.TimeDuration) *eventpb.Event

func TimerGarbageCollect

func TimerGarbageCollect(destModule t.ModuleID, retIndex t.RetentionIndex) *eventpb.Event

func TimerRepeat

func TimerRepeat(
	destModule t.ModuleID,
	events []*eventpb.Event,
	delay t.TimeDuration,
	retIndex t.RetentionIndex,
) *eventpb.Event

func VerifyNodeSigs

func VerifyNodeSigs(
	destModule t.ModuleID,
	data [][][]byte,
	signatures [][]byte,
	nodeIDs []t.NodeID,
	origin *eventpb.SigVerOrigin,
) *eventpb.Event

VerifyNodeSigs returns an event representing a request to the crypto module for verifying a batch of node signatures. The origin is an object used to maintain the context for the requesting module and will be included in the NodeSigsVerified event produced by the crypto module. For each signed message, the data argument contains a slice of byte slices (thus [][][]byte)

func WALAppend

func WALAppend(destModule t.ModuleID, event *eventpb.Event, retentionIndex t.RetentionIndex) *eventpb.Event

WALAppend returns an event of appending a new entry to the WAL. This event is produced by the protocol state machine for persisting its state.

func WALEntry

func WALEntry(persistedEvent *eventpb.Event, retentionIndex t.RetentionIndex) *eventpb.Event

WALEntry returns an event of reading an entry from the WAL. Those events are used at system initialization.

func WALTruncate

func WALTruncate(destModule t.ModuleID, retentionIndex t.RetentionIndex) *eventpb.Event

WALTruncate returns and event on removing all entries from the WAL that have been appended with a retentionIndex smaller than the specified one.

Types

type EventList

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

EventList represents a list of Events, e.g. as produced by a module.

func EmptyList

func EmptyList() *EventList

EmptyList returns an empty EventList. TODO: consider passing EventList by value here and everywhere else.

func ListOf

func ListOf(events ...*eventpb.Event) *EventList

ListOf returns EventList containing the given elements.

func Strip

func Strip(event *eventpb.Event) (*eventpb.Event, *EventList)

Strip returns a new identical (shallow copy of the) event, but with all follow-up events (stored under event.Next) removed. The removed events are stored in a new EventList that Strip returns a pointer to as the second return value.

func (*EventList) Head

func (el *EventList) Head(n int) *EventList

Head returns the first up to n events in the list as a new list. The original list is not modified.

func (*EventList) Iterator

func (el *EventList) Iterator() *EventListIterator

Iterator returns a pointer to an EventListIterator object used to iterate over the events in this list, starting from the beginning of the list.

func (*EventList) Len

func (el *EventList) Len() int

Len returns the number of events in the EventList.

func (*EventList) PushBack

func (el *EventList) PushBack(event *eventpb.Event) *EventList

PushBack appends an event to the end of the list. Returns the EventList itself, for the convenience of chaining multiple calls to PushBack.

func (*EventList) PushBackList

func (el *EventList) PushBackList(newEvents *EventList) *EventList

PushBackList appends all events in newEvents to the end of the current EventList.

func (*EventList) PushBackSlice

func (el *EventList) PushBackSlice(events []*eventpb.Event) *EventList

PushBackSlice appends all events in newEvents to the end of the current EventList.

func (*EventList) RemoveFront

func (el *EventList) RemoveFront(n int) int

RemoveFront removes the first up to n events from the list. Returns the number of events actually removed.

func (*EventList) Slice

func (el *EventList) Slice() []*eventpb.Event

Slice returns a slice representation of the current state of the list. The returned slice only contains pointers to the events in this list, no deep copying is performed. Any modifications performed on the events will affect the contents of both the EventList and the returned slice.

func (*EventList) StripFollowUps

func (el *EventList) StripFollowUps() (*EventList, *EventList)

StripFollowUps collects all follow-up Events of the Events in the list. It returns two lists: 1. An EventList containing the same events as this list, but with all follow-up events removed. 2. An EventList containing only those follow-up events.

type EventListIterator

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

EventListIterator is an object returned from EventList.Iterator used to iterate over the elements (Events) of an EventList using the iterator's Next method.

func (*EventListIterator) Next

func (eli *EventListIterator) Next() *eventpb.Event

Next will return the next Event until the end of the associated EventList is encountered. Thereafter, it will return nil.

Jump to

Keyboard shortcuts

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