event

package
v1.0.0-alpha1.0...-2e0dbe4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Byter

type Byter interface {
	Bytes() []byte
}

type ConcreteEvent

type ConcreteEvent struct {
	Kind string    `json:"kind"`
	ID   uint64    `json:"id"`
	At   time.Time `json:"at"`
	Data any       `json:"data"`
}

func (ConcreteEvent) Render

func (e ConcreteEvent) Render() string

func (ConcreteEvent) String

func (e ConcreteEvent) String() string

type ContextSetter

type ContextSetter interface {
	SetContext(ctx context.Context)
}

type Event

type Event struct {
	// Kind can be either "patch" or "event".
	// A patch is a change to the cluster dataset.
	//
	// Event subscribers can maintain a clone of the
	// cluster dataset by:
	// installing a full dataset with received full dataset
	// or
	// patching a full dataset with received patch events
	Kind string `json:"kind"`

	// ID is a unique event id
	ID uint64 `json:"id"`

	// At is the time the event was published
	At time.Time `json:"at"`

	// Data is the free-format dataset of the event
	Data json.RawMessage `json:"data"`
}

Event describes a opensvc daemon event

func ToEvent

func ToEvent(i any, id uint64) *Event

func (Event) AsConcreteEvent

func (e Event) AsConcreteEvent(data any) *ConcreteEvent

func (Event) Render

func (e Event) Render() string

Render formats a opensvc agent event

func (Event) String

func (e Event) String() string

type Kinder

type Kinder interface {
	Kind() string
}

type ReadCloser

type ReadCloser interface {
	Reader
	Close() error
}

type Reader

type Reader interface {
	Read() (*Event, error)
}

type Stringer

type Stringer interface {
	String() string
}

type Timer

type Timer interface {
	Time() time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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