events

package
v0.0.0-...-bd4e2c0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnounceDummyBatch

func AnnounceDummyBatch(sn t.SeqNr, batch *requestpb.Batch) *eventpb.Event

func AppSnapshot

func AppSnapshot(sn t.SeqNr, data []byte) *eventpb.Event

AppSnapshot returns an event representing the application making a snapshot of its state. sn is the number of batches delivered to the application when taking the snapshot (i.e. the sequence number of the first unprocessed batch) and data is the serialized application state (the snapshot itself).

func AppSnapshotRequest

func AppSnapshotRequest(sn t.SeqNr) *eventpb.Event

AppSnapshotRequest returns an event representing the protocol module asking the application for a state snapshot. sn is the number of batches delivered to the application when taking the snapshot (i.e. the sequence number of the first unprocessed batch). The application itself need not be aware of sn, it is only by the protocol to be able to identify the response of the application in form of an AppSnapshot event.

func ClientRequest

func ClientRequest(clientID t.ClientID, reqNo t.ReqNo, data []byte, authenticator []byte) *eventpb.Event

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

func Deliver

func Deliver(sn t.SeqNr, batch *requestpb.Batch) *eventpb.Event

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

func HashRequest

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

HashRequest returns an event representing a request to the hashing module for computing the hash of data. 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(digest []byte, origin *eventpb.HashOrigin) *eventpb.Event

HashResult returns an event representing the computation of a hash by the hashing module. It contains the computed digest 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 Init

func Init() *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(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 PersistDummyBatch

func PersistDummyBatch(sn t.SeqNr, batch *requestpb.Batch) *eventpb.Event

func RequestReady

func RequestReady(requestRef *requestpb.RequestRef) *eventpb.Event

RequestReady returns an event signifying that a new request is ready to be inserted into the protocol state machine. This normally occurs when the request has been received, persisted, authenticated, and an authenticator is available.

func RequestSigVerified

func RequestSigVerified(reqRef *requestpb.RequestRef, valid bool, error string) *eventpb.Event

RequestSigVerified represents the result of a client signature verification by the Crypto module. It is routed to the client tracker that initially issued a VerifyRequestSig event.

func SendMessage

func SendMessage(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 StoreDummyRequest

func StoreDummyRequest(reqRef *requestpb.RequestRef, data []byte) *eventpb.Event

func StoreVerifiedRequest

func StoreVerifiedRequest(reqRef *requestpb.RequestRef, data []byte, authenticator []byte) *eventpb.Event

StoreVerifiedRequest returns an event representing an event the ClientTracker emits to request storing a request, including its payload and authenticator, in the request store.

func Tick

func Tick() *eventpb.Event

Tick returns an event representing a tick - the event of one step of logical time having elapsed.

func VerifyRequestSig

func VerifyRequestSig(reqRef *requestpb.RequestRef, signature []byte) *eventpb.Event

VerifyRequestSig returns an event of a client tracker requesting the verification of a client request signature. This event is routed to the Crypto module that issues a RequestSigVerified event in response.

func WALAppend

func WALAppend(event *eventpb.Event, retentionIndex t.WALRetIndex) *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.WALRetIndex) *eventpb.Event

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

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 Strip

func Strip(event *eventpb.Event) *EventList

Strip removes the follow-up events from event (stored under event.Next) and sets event.Next to nil. The removed events are stored in a new EventList that Strip returns a pointer to.

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) 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

StripFollowUps removes all follow-up Events from the Events in the list and returns them. Note that StripFollowUps modifies the events in the list by calling Strip on each event in the EventList. After StripFollowUps returns, all events in the list will have no follow-ups. StripFollowUps accumulates all those follow-up Events in a new EventList that it returns.

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