event

package
v0.0.0-...-a733983 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Emit

func Emit(ctx context.Context, event any)

func Listen

func Listen[T any](ctx context.Context, ch chan<- TypedEnvelope[T])

func NewBus

func NewBus(ctx context.Context) context.Context

func RegisterEventType

func RegisterEventType(e any)

func Tap

func Tap(ctx context.Context, ch chan<- Envelope)

func Unlisten

func Unlisten[T any](ctx context.Context, ch chan<- TypedEnvelope[T])

func Untap

func Untap(ctx context.Context, ch chan<- Envelope)

Types

type DeleteLogFile

type DeleteLogFile struct {
	Path   string
	Stream string
}

type DiskMetrics

type DiskMetrics struct {
	Total     uint64
	Free      uint64
	MaxFiles  uint64
	FreeFiles uint64
}

type Envelope

type Envelope struct {
	Event any
	ID    uuid.UUID
	Time  time.Time
}

func (Envelope) MarshalJSON

func (e Envelope) MarshalJSON() ([]byte, error)

func (Envelope) Type

func (e Envelope) Type() reflect.Type

func (Envelope) TypeName

func (e Envelope) TypeName() string

func (*Envelope) UnmarshalJSON

func (e *Envelope) UnmarshalJSON(bs []byte) error

type Key

type Key any

type LogFile

type LogFile struct {
	Path   string
	Offset int64
}

type Metrics

type Metrics struct {
	Uptime   int64
	Loads    [3]uint64
	Mem      uint64
	MemFree  uint64
	Swap     uint64
	SwapFree uint64
	Procs    uint16
	Disks    map[string]DiskMetrics
}

type OpenLogFile

type OpenLogFile struct {
	Path   string
	Stream string
}

type Status

type Status string
const (
	StatusBooting   Status = "booting"
	StatusReady     Status = "ready"
	StatusStopping  Status = "stopping"
	StatusModifying Status = "modifying"
	StatusStopped   Status = "stopped"
)

type Sync

type Sync struct {
	Status  Status               `json:"status"`
	Metrics Metrics              `json:"metrics"`
	Logs    map[string][]LogFile `json:"logs"`
}

type TypedEnvelope

type TypedEnvelope[T any] struct {
	Event     T
	ID        uuid.UUID
	Time      time.Time
	EventType reflect.Type
}

func (TypedEnvelope[T]) Envelope

func (e TypedEnvelope[T]) Envelope() Envelope

func (TypedEnvelope[T]) Type

func (e TypedEnvelope[T]) Type() reflect.Type

func (TypedEnvelope[T]) TypeName

func (e TypedEnvelope[T]) TypeName() string

type UnknownEventError

type UnknownEventError struct {
	Type string
}

func (UnknownEventError) Error

func (e UnknownEventError) Error() string

Jump to

Keyboard shortcuts

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