Documentation ¶
Overview ¶
Package state contains structures to monitor and update the state of the collector in the package status
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFailedStatus is the error when the Package status indicates a failure ErrFailedStatus = errors.New("package status indicates failure") )
Functions ¶
This section is empty.
Types ¶
type CollectorMonitor ¶
type CollectorMonitor struct {
// contains filtered or unexported fields
}
CollectorMonitor implements Monitor interface for monitoring the Collector Package Status file
func (*CollectorMonitor) MonitorForSuccess ¶
func (c *CollectorMonitor) MonitorForSuccess(ctx context.Context, packageName string) error
MonitorForSuccess intermittently checks the package status file for either an install failed or success status. If an InstallFailed status is read this returns ErrFailedStatus error. If the context is canceled the context error will be returned.
func (*CollectorMonitor) SetState ¶
func (c *CollectorMonitor) SetState(packageName string, status protobufs.PackageStatusEnum, statusErr error) error
SetState sets the status on the specified package and saves it to the package status file
type Monitor ¶
type Monitor interface { // SetState sets the state for the package. // If passed in statusErr is not nil it will record the error as the message SetState(packageName string, status protobufs.PackageStatusEnum, statusErr error) error // MonitorForSuccess will periodically check the state of the package. It will keep checking until the context is canceled or a failed/success state is detected. // It will return an error if status is Failed or if the context times out. MonitorForSuccess(ctx context.Context, packageName string) error }
Monitor allows checking and setting state of active install
Click to show internal directories.
Click to hide internal directories.