status

package module
v0.0.0-...-23465b2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CountInfo

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

CountInfo records a simple count

func NewCountInfo

func NewCountInfo(key string) *CountInfo

NewCountInfo creates a new CountInfo instance

func (*CountInfo) Add

func (c *CountInfo) Add(v int64)

Add a new value to the count

func (*CountInfo) Get

func (c *CountInfo) Get() int64

Get the underlying value of the count

func (*CountInfo) Info

func (c *CountInfo) Info() []string

Info returns the info

func (*CountInfo) InfoKey

func (c *CountInfo) InfoKey() string

InfoKey returns the key

type InfoProvider

type InfoProvider interface {
	InfoKey() string
	Info() []string
}

InfoProvider is a general interface to hold and render info for the status page.

When implementing InfoProvider - be aware of the 2 ways it is used by the status page:

  1. when a single message is returned, the status page will display a single line: InfoKey(): Info()[0]

  2. when multiple messages are returned, the status page will display an indented list: InfoKey(): Info()[0] Info()[1] Info()[n]

InfoKey only needs to be unique per source, and should be human readable.

type InfoRegistry

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

InfoRegistry keeps track of info providers

func NewInfoRegistry

func NewInfoRegistry() *InfoRegistry

NewInfoRegistry creates a new InfoRegistry instance

func (*InfoRegistry) All

func (i *InfoRegistry) All() []InfoProvider

All returns all registered info providers.

func (*InfoRegistry) Get

func (i *InfoRegistry) Get(key string) InfoProvider

Get returns the provider for a given key, or nil

func (*InfoRegistry) Register

func (i *InfoRegistry) Register(info InfoProvider)

Register adds an info provider

func (*InfoRegistry) Rendered

func (i *InfoRegistry) Rendered() map[string][]string

Rendered renders the info for display on the status page.

type LogStatus

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

LogStatus tracks errors and success.

func NewLogStatus

func NewLogStatus() *LogStatus

NewLogStatus creates a new log status.

func (*LogStatus) Dump

func (s *LogStatus) Dump() string

Dump provides a single-line dump of the status, for debugging purposes.

func (*LogStatus) Error

func (s *LogStatus) Error(err error)

Error records the given error and invalidates the source.

func (*LogStatus) GetError

func (s *LogStatus) GetError() string

GetError returns the error.

func (*LogStatus) IsError

func (s *LogStatus) IsError() bool

IsError returns whether the current status is an error.

func (*LogStatus) IsPending

func (s *LogStatus) IsPending() bool

IsPending returns whether the current status is not yet determined.

func (*LogStatus) IsSuccess

func (s *LogStatus) IsSuccess() bool

IsSuccess returns whether the current status is a success.

func (*LogStatus) Success

func (s *LogStatus) Success()

Success sets the status to success.

type MappedInfo

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

MappedInfo collects multiple info messages with a unique key

func NewMappedInfo

func NewMappedInfo(key string) *MappedInfo

NewMappedInfo creates a new MappedInfo instance

func (*MappedInfo) Info

func (m *MappedInfo) Info() []string

Info returns the info

func (*MappedInfo) InfoKey

func (m *MappedInfo) InfoKey() string

InfoKey returns the key

func (*MappedInfo) RemoveMessage

func (m *MappedInfo) RemoveMessage(key string)

RemoveMessage removes a message with a unique key

func (*MappedInfo) SetMessage

func (m *MappedInfo) SetMessage(key string, message string)

SetMessage sets a message with a unique key

Jump to

Keyboard shortcuts

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