events

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHub

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

func NewEventHub

func NewEventHub(logger runtime.Logger, eventsEndpoint string, cardinalAddress string) (*EventHub, error)

func (*EventHub) Dispatch

func (eh *EventHub) Dispatch(log runtime.Logger) error

Dispatch continually drains eh.inputConnection (events from cardinal) and sends copies to all subscribed channels. This function is meant to be called in a goroutine.

func (*EventHub) Shutdown

func (eh *EventHub) Shutdown()

func (*EventHub) SubscribeToEvents

func (eh *EventHub) SubscribeToEvents(session string) chan []byte

func (*EventHub) SubscribeToReceipts

func (eh *EventHub) SubscribeToReceipts(session string) chan []Receipt

func (*EventHub) Unsubscribe

func (eh *EventHub) Unsubscribe(session string)

type Notifier

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

Notifier is a struct that sends out notifications to users based on transaction receipts.

func NewNotifier

func NewNotifier(logger runtime.Logger, nk runtime.NakamaModule, eh *EventHub) *Notifier

func (*Notifier) AddTxHashToPendingNotifications

func (r *Notifier) AddTxHashToPendingNotifications(txHash string, userID string)

AddTxHashToPendingNotifications adds the given user ID and tx hash to pending notifications. When this system becomes aware of a transaction receipt with the given tx hash, the given user will be sent a notification with any results and errors. This method is safe for concurrent access.

type Receipt

type Receipt struct {
	TxHash string         `json:"txHash"`
	Result map[string]any `json:"result"`
	Errors []string       `json:"errors"`
}

type TickResults

type TickResults struct {
	Tick     uint64
	Receipts []Receipt
	Events   [][]byte
}

type TransactionReceiptsReply

type TransactionReceiptsReply struct {
	StartTick uint64     `json:"startTick"`
	EndTick   uint64     `json:"endTick"`
	Receipts  []*Receipt `json:"receipts"`
}

Jump to

Keyboard shortcuts

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