events

package
v0.4.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

func Redirect

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

func TestingString

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

func TestingUint

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

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