events

package
v0.4.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventFactoryRegistry = map[string]*EventFactory{}
)

Functions

func RegisterEventFactory

func RegisterEventFactory(obj runtime.Object, onAdded EventBuilder, onUpdated EventBuilder, onDeleted EventBuilder)

RegisterEventFactory register events builders for a particular resource type.

func ResourceMessageKind

func ResourceMessageKind(obj runtime.Object) string

ResourceMessageKind returns the type of the object that is the content of the message

Types

type Envelope

type Envelope struct {
	Header  *Header     `json:"header"`
	Message interface{} `json:"message"`
}

Envelope is the data structure that holds the information to be published by the Broker

func (*Envelope) AddHeader

func (e *Envelope) AddHeader(key, value string)

AddHeader adds a new header for a particular Envelope

func (*Envelope) Encode

func (e *Envelope) Encode() ([]byte, error)

Encode returns the encoded version of the Envelope. This is useful when sending non structure data on the wire

type Event

type Event interface {
	EventSource() EventSource
	EventType() EventType
}

Event is the contract for events handled by EventHandlers

func FleetAdded

func FleetAdded(message Message) Event

FleetAdded is the data structure for reconcile events of type Add

func FleetDeleted

func FleetDeleted(message Message) Event

FleetDeleted is the data structure for reconcile events of type Delete

func FleetUpdated

func FleetUpdated(message Message) Event

FleetUpdated is the data structure for reconcile events of type Update

func GameServerAdded

func GameServerAdded(message Message) Event

GameServerAdded is the data structure for reconcile events of type Add

func GameServerDeleted

func GameServerDeleted(message Message) Event

GameServerDeleted is the data structure for reconcile events of type Delete

func GameServerUpdated

func GameServerUpdated(message Message) Event

GameServerUpdates is the data structure for reconcile events of type Update

func OnAdded

func OnAdded(message Message) Event

OnAdded builds an event of type OnAdded for a particular message content type

func OnDeleted

func OnDeleted(message Message) Event

OnDeleted builds an event of type OnDeleted for a particular message content type

func OnUpdated

func OnUpdated(message Message) Event

OnUpdated builds an event of type OnUpdated for a particular message content type

type EventBuilder

type EventBuilder func(message Message) Event

type EventFactory

type EventFactory struct {
	OnAdded   EventBuilder
	OnUpdated EventBuilder
	OnDeleted EventBuilder
}

type EventMessage

type EventMessage struct {
	Body interface{} `json:"body"`
}

EventMessage is the data structure for messages that are resulting of reconcile events.

func (*EventMessage) Content

func (e *EventMessage) Content() interface{}

Content extracts the body of the EventMessage

type EventSource

type EventSource string
var (
	EventSourceOnAdd    EventSource = "OnAdd"
	EventSourceOnUpdate EventSource = "OnUpdate"
	EventSourceOnDelete EventSource = "OnDelete"
)

func (EventSource) String

func (s EventSource) String() string

String returns the string representation of a EventType

type EventType

type EventType string

func (EventType) String

func (t EventType) String() string

String returns the string representation of a EventType

type FleetEvent

type FleetEvent struct {
	Source  EventSource    `json:"source"`
	Type    FleetEventType `json:"type"`
	Message `json:"message"`
}

FleetEvent is the data structure for reconcile events associated with Agones Fleets It holds the event source (OnAdd, OnUpdate, OnDelete) and the event type (Added, Updated, Deleted).

func (*FleetEvent) EventSource

func (t *FleetEvent) EventSource() EventSource

EventSource return the event source that generated the event. For example: OnAdd, OnUpdate, OnDelete

func (*FleetEvent) EventType

func (t *FleetEvent) EventType() EventType

EventType returns the type of the reconcile event for a Fleet. For example: Added, Updated, Deleted

type FleetEventType

type FleetEventType string
var (
	FleetEventAdded   FleetEventType = "fleet.events.added"
	FleetEventUpdated FleetEventType = "fleet.events.updated"
	FleetEventDeleted FleetEventType = "fleet.events.deleted"
)

func (FleetEventType) String

func (t FleetEventType) String() string

String is a helper method that returns the string version of a FleetEventType

type GameServerEvent

type GameServerEvent struct {
	Source  EventSource         `json:"source"`
	Type    GameServerEventType `json:"type"`
	Message `json:"message"`
}

GameServerEvent is the data structure for reconcile events associated with Agones GameServers It holds the event source (OnAdd, OnUpdate, OnDelete) and the event type (Added, Updated, Deleted).

func (*GameServerEvent) EventSource

func (t *GameServerEvent) EventSource() EventSource

EventSource return the event source that generated the event. For example: OnAdd, OnUpdate, OnDelete

func (*GameServerEvent) EventType

func (t *GameServerEvent) EventType() EventType

EventType returns the type of the reconcile event for a GameServer. For example: Added, Updated, Deleted

type GameServerEventType

type GameServerEventType string
var (
	GameServerEventAdded   GameServerEventType = "gameserver.events.added"
	GameServerEventUpdated GameServerEventType = "gameserver.events.updated"
	GameServerEventDeleted GameServerEventType = "gameserver.events.deleted"
)

func (GameServerEventType) String

func (t GameServerEventType) String() string

String is a helper method that returns the string version of a GameServerEventType

type Header struct {
	Headers map[string]string `json:"headers"`
}

Header is the data structure for headers used when building Envelopes. It is a flexible way of storing information to be used in any part of the publishing process

type Message

type Message interface {
	Content() interface{}
}

Message is the contract for messages published by Brokers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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