informers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventType

func EventType(name string) events.EventType

EventType returns events.EventType for a given key

func Filter

func Filter(n *Notification, reducer func(n *Notification) bool) bool

Filter a notification based on given reducer.

func Reduce

func Reduce(req *events.WatchRequest) func(n *Notification) bool

Reduce returns a closure to filter notifications.

func ResourceType

func ResourceType(name string) events.ResourceType

ResourceType returns events.ResourceType for a given key

Types

type Informer

type Informer interface {
	Start(ctx context.Context, req *events.WatchRequest, fn func(e *events.Event) error) error
}

Informer is the base informer

func New

func New() Informer

New returns an instance of event informer

type Notification

type Notification struct {
	ID           string      `json:"id,omitempty"`
	ResourceID   string      `json:"resource_id,omitempty"`
	ResourceType string      `json:"resource_type,omitempty"`
	EventType    string      `json:"event_type,omitempty"`
	Data         interface{} `json:"data,omitempty"`
	CreatedAt    *time.Time  `json:"created_at,omitempty"`
}

Notification represents an event notification

func (*Notification) Prefix

func (n *Notification) Prefix()

Prefix adds prefix to notification's resource and event type

func (Notification) ToEvent

func (n Notification) ToEvent() (*events.Event, error)

ToEvent converts a notification into events.Event type

Jump to

Keyboard shortcuts

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