Documentation ¶
Index ¶
- Constants
- func UseLogger(logger btclog.Logger)
- type Manager
- func (s *Manager) IsSystemReady(name, req string) (bool, bool, error)
- func (s *Manager) RegisterAndEnableSubServer(name string, opts ...SubServerOption)
- func (s *Manager) RegisterSubServer(name string, opts ...SubServerOption)
- func (s *Manager) SetCustomStatus(name, customStatus string)
- func (s *Manager) SetEnabled(name string)
- func (s *Manager) SetErrored(name string, errStr string, params ...interface{})
- func (s *Manager) SetRunning(name string)
- func (s *Manager) SetStopped(name string)
- func (s *Manager) SubServerStatus(_ context.Context, _ *litrpc.SubServerStatusReq) (*litrpc.SubServerStatusResp, error)
- type SubServerOption
Constants ¶
const Subsystem = "STAT"
Variables ¶
This section is empty.
Functions ¶
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 (*Manager) IsSystemReady ¶
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 ¶
SetCustomStatus updates the custom status of the given sub-server to the passed status.
func (*Manager) SetEnabled ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (s *Manager) SubServerStatus(_ context.Context, _ *litrpc.SubServerStatusReq) (*litrpc.SubServerStatusResp, error)
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.