events

package
v0.19.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package events provides functionalities for packages to log their states as events for others to consume and display to end users in meaningful ways.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus chan Event

Bus is a send/receive event bus.

func NewBus

func NewBus() Bus

NewBus creates a new event bus to send/receive events.

func (Bus) Send

func (b Bus) Send(e Event)

Send sends a new event to bus.

func (Bus) Shutdown

func (b Bus) Shutdown()

Shutdown shutdowns event bus.

type Event

type Event struct {

	// Description of the state.
	Description string
	// contains filtered or unexported fields
}

Event represents a state.

func New

func New(status Status, description string) Event

New creates a new event with given config.

func (Event) IsOngoing

func (e Event) IsOngoing() bool

IsOngoing checks if state change that triggered this event is still ongoing.

func (Event) Text

func (e Event) Text() string

Text returns the text state of event.

type Status

type Status int

Status shows if state is ongoing or completed.

const (
	StatusOngoing Status = iota
	StatusDone
)

Jump to

Keyboard shortcuts

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