Documentation
¶
Index ¶
- func GetSingleStatusItem(ctx *log.Context, statusType types.StatusType, c types.Cmd, msg string, ...) (types.StatusItem, error)
- func MarshalStatusReportIntoJson(statusReport types.StatusReport, indent bool) ([]byte, error)
- func RemoveDisabledAndUpdatedGoalStatesInLocalStatusFile(ctx *log.Context, goalStateKeysToRemove []types.GoalStateKey) error
- func ReportStatusToLocalFile(ctx *log.Context, hEnv types.HandlerEnvironment, metadata types.RCMetadata, ...) error
- func SaveGoalStatesInTerminalStatus(ctx *log.Context, newStatusInTerminalState []ImmediateStatus) error
- func SaveStatusReport(statusFolder string, extName string, seqNo int, rootStatusJson []byte) error
- type ImmediateHandlerStatus
- type ImmediateStatus
- type ImmediateTopLevelStatus
- type StatusObserver
- func (o *StatusObserver) GetStatusForKey(key types.GoalStateKey) (types.StatusItem, bool)
- func (o *StatusObserver) Initialize(ctx *log.Context)
- func (o *StatusObserver) OnDemandNotify() error
- func (o *StatusObserver) OnNotify(status types.StatusEventArgs) error
- func (o *StatusObserver) RemoveProcessedGoalStates(goalStateKeys []types.GoalStateKey)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSingleStatusItem ¶ added in v1.3.14
func GetSingleStatusItem(ctx *log.Context, statusType types.StatusType, c types.Cmd, msg string, extName string) (types.StatusItem, error)
getSingleStatusItem returns a single status item for the given status type, command, and message. This is useful when only a single status item is needed for an immediate status report.
func MarshalStatusReportIntoJson ¶ added in v1.3.11
func MarshalStatusReportIntoJson(statusReport types.StatusReport, indent bool) ([]byte, error)
func RemoveDisabledAndUpdatedGoalStatesInLocalStatusFile ¶ added in v1.3.17
func RemoveDisabledAndUpdatedGoalStatesInLocalStatusFile(ctx *log.Context, goalStateKeysToRemove []types.GoalStateKey) error
GetGoalStatesInTerminalStatus retrieves the goal states in terminal status from the file Then it removes the disabled goal states and updated goal states from the list This avoid reporting disabled goal states to the HGAP and also avoid reporting blocking the communication channel when the goal state is updated
func ReportStatusToLocalFile ¶
func ReportStatusToLocalFile(ctx *log.Context, hEnv types.HandlerEnvironment, metadata types.RCMetadata, statusType types.StatusType, c types.Cmd, msg string) error
ReportStatusToLocalFile saves operation status to the status file for the extension handler with the optional given message, if the given cmd requires reporting status.
If an error occurs reporting the status, it will be logged and returned.
This function is used by default for reporting status to the local file system unless a different method is specified.
func SaveGoalStatesInTerminalStatus ¶ added in v1.3.17
func SaveGoalStatesInTerminalStatus(ctx *log.Context, newStatusInTerminalState []ImmediateStatus) error
func SaveStatusReport ¶ added in v1.3.11
SaveStatusReport persists the status message to the specified status folder using the sequence number. The operation consists of writing to a temporary file in the same folder and moving it to the final destination for atomicity.
Types ¶
type ImmediateHandlerStatus ¶ added in v1.3.14
type ImmediateHandlerStatus struct { HandlerName string `json:"handlerName" validate:"required"` AggregateImmediateStatus []ImmediateStatus `json:"aggregateImmediateStatus" validate:"required"` }
Status of the handler that is capable of handling immediate goal states
type ImmediateStatus ¶ added in v1.3.14
type ImmediateStatus struct { SequenceNumber int `json:"sequenceNumber" validate:"required"` TimestampUTC string `json:"timestampUTC" validate:"required"` Status types.Status `json:"status" validate:"required"` }
Status of an immediate extension processed by a given handler
func GetGoalStatesInTerminalStatus ¶ added in v1.3.17
func GetGoalStatesInTerminalStatus(ctx *log.Context) ([]ImmediateStatus, error)
getGoalStatesInTerminalStatus retrieves the goal states in terminal status from the file The file is located in the extension directory under the immediate status folder
type ImmediateTopLevelStatus ¶ added in v1.3.14
type ImmediateTopLevelStatus struct {
AggregateHandlerImmediateStatus []ImmediateHandlerStatus `json:"aggregateHandlerImmediateStatus" validate:"required"`
}
This is the serializable data contract for VM Aggregate Immediate Status in CRP
type StatusObserver ¶ added in v1.3.14
type StatusObserver struct { // Reporter is the status Reporter Reporter statusreporter.IGuestInformationServiceClient // contains filtered or unexported fields }
Observer defines a type that can receive notifications from a Notifier. Must implement the Observer interface.
func (*StatusObserver) GetStatusForKey ¶ added in v1.3.14
func (o *StatusObserver) GetStatusForKey(key types.GoalStateKey) (types.StatusItem, bool)
func (*StatusObserver) Initialize ¶ added in v1.3.14
func (o *StatusObserver) Initialize(ctx *log.Context)
func (*StatusObserver) OnDemandNotify ¶ added in v1.3.17
func (o *StatusObserver) OnDemandNotify() error
func (*StatusObserver) OnNotify ¶ added in v1.3.14
func (o *StatusObserver) OnNotify(status types.StatusEventArgs) error
func (*StatusObserver) RemoveProcessedGoalStates ¶ added in v1.3.14
func (o *StatusObserver) RemoveProcessedGoalStates(goalStateKeys []types.GoalStateKey)
Remove the goal states that have already been processed from the event map or are disabled If the goal state that was added before is not in the new list of goal states, it should be removed This is to ensure that the event map only contains the goal states that are currently being processed