status

package
v0.12.4-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Subsystem = "STAT"

Variables

This section is empty.

Functions

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type Manager

type Manager struct {
	litrpc.UnimplementedStatusServer
	// contains filtered or unexported fields
}

Manager manages the status of any sub-server registered to it. It is also an implementation of the litrpc.StatusServer which can be queried for the status of various LiT sub-servers.

func NewStatusManager

func NewStatusManager() *Manager

NewStatusManager constructs a new Manager.

func (*Manager) IsSystemReady

func (s *Manager) IsSystemReady(name, req string) (bool, bool, error)

IsSystemReady shows if the given sub-server ready to handle the a request for the passed request URI. The first returned boolean is true if the system is ready to handle the request. The second returned boolean is true if the system has been disabled.

func (*Manager) RegisterAndEnableSubServer

func (s *Manager) RegisterAndEnableSubServer(name string,
	opts ...SubServerOption)

RegisterAndEnableSubServer will create a new sub-server entry for the Manager to keep track of and will set it as enabled.

func (*Manager) RegisterSubServer

func (s *Manager) RegisterSubServer(name string, opts ...SubServerOption)

RegisterSubServer will create a new sub-server entry for the Manager to keep track of.

func (*Manager) SetCustomStatus

func (s *Manager) SetCustomStatus(name, customStatus string)

SetCustomStatus updates the custom status of the given sub-server to the passed status.

func (*Manager) SetEnabled

func (s *Manager) SetEnabled(name string)

SetEnabled marks the sub-server with the given name as enabled.

NOTE: This will silently fail if the referenced sub-server has not yet been registered.

func (*Manager) SetErrored

func (s *Manager) SetErrored(name string, errStr string,
	params ...interface{})

SetErrored can be used to set the status of a sub-server as not Running and also to set an error message for the sub-server.

NOTE: This will silently fail if the referenced sub-server has not yet been registered.

func (*Manager) SetRunning

func (s *Manager) SetRunning(name string)

SetRunning can be used to set the status of a sub-server as Running with no errors.

NOTE: This will silently fail if the referenced sub-server has not yet been registered.

func (*Manager) SetStopped

func (s *Manager) SetStopped(name string)

SetStopped can be used to set the status of a sub-server as not Running and with no errors.

NOTE: This will silently fail if the referenced sub-server has not yet been registered.

func (*Manager) SubServerStatus

SubServerStatus queries the current status of a given sub-server.

NOTE: this is part of the litrpc.StatusServer interface.

type SubServerOption

type SubServerOption func(status *subServer)

SubServerOption defines a functional option that can be used to modify the values of a subServer's fields.

func WithIsReadyOverride

func WithIsReadyOverride(fn func(string, string) (bool, bool)) SubServerOption

WithIsReadyOverride is a functional option that can be used to set a callback function that is used to check if a system is ready _iff_ the system running status is not yet true. The call-back will be passed the request URI along with any manual status that has been set for the subsystem.

Jump to

Keyboard shortcuts

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