notification

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HardRestartMessage = "__hard_restart"
View Source
const SoftRestartMessage = "__soft_reload"

Variables

This section is empty.

Functions

func NextID added in v0.6.0

func NextID() string

Types

type EventConsumer added in v0.6.0

type EventConsumer interface {
	Notify(n Notification) error
}

type Notification

type Notification struct {
	ID              string           `json:"id" db:"id"` // snowflake
	Date            time.Time        `json:"createdAt" db:"created_at"`
	ChildProccessID string           `json:"childProcessId" db:"child_process_id"` // snowflake
	Type            NotificationType `json:"type" db:"event_type"`
	Message         string           `json:"message" db:"event_data"`
}

type NotificationCallback added in v0.6.0

type NotificationCallback func(n Notification) error

type NotificationType

type NotificationType int
const (
	NotificationTypeSystemError NotificationType = iota
	NotificationTypeSoftRestartRequested
	NotificationTypeHardRestartRequested
	NotificationTypeOOBTaskRequested
	NotificationTypeShutdownRequested
	NotificationTypeSystemShutdown
	NotificationTypeStartup
	NotificationTypeHardRestart
	NotificationTypeSoftRestart
	NotificationTypeShutdown
	NotificationTypeLogEvent
	NotificationTypeStdOut
	NotificationTypeStdErr
	NotificationTypeOOBTaskStartup
	NotificationTypeOOBTaskStdOut
	NotificationTypeOOBTaskStdErr
	NotificationTypeIPC
)

type Notifier added in v0.6.0

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

func NewNotifier added in v0.6.0

func NewNotifier(callbackFn NotificationCallback) (*Notifier, error)

func (*Notifier) Close added in v0.6.0

func (n *Notifier) Close() error

func (*Notifier) Notify added in v0.6.0

func (n *Notifier) Notify(notif Notification) error

func (*Notifier) SendSoftRestart added in v0.6.1

func (n *Notifier) SendSoftRestart(hint string) error

func (*Notifier) Start added in v0.6.0

func (n *Notifier) Start() error

Jump to

Keyboard shortcuts

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