task

package
v0.0.0-...-f282198 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wait

Wait waits for a task to finish with either success or failure. It does so by waiting for the "info" property of task managed object to change. The function returns when it finds the task in the "success" or "error" state. In the former case, the return value is nil. In the latter case the return value is an instance of this package's Error struct.

Any error returned while waiting for property changes causes the function to return immediately and propagate the error.

If the progress.Sinker argument is specified, any progress updates for the task are sent here. The completion percentage is passed through directly. The detail for the progress update is set to an empty string. If the task finishes in the error state, the error instance is passed through as well. Note that this error is the same error that is returned by this function.

Types

type Error

type Error struct {
	*types.LocalizedMethodFault
	Description *types.LocalizableMessage
}

func (Error) Error

func (e Error) Error() string

Error returns the task's localized fault message.

func (Error) Fault

func (e Error) Fault() types.BaseMethodFault

type HistoryCollector

type HistoryCollector struct {
	*history.Collector
}

HistoryCollector provides a mechanism for retrieving historical data and updates when the server appends new tasks.

func (HistoryCollector) LatestPage

func (h HistoryCollector) LatestPage(ctx context.Context) ([]types.TaskInfo, error)

LatestPage returns items in the 'viewable latest page' of the task history collector. As new tasks that match the collector's TaskFilterSpec are created, they are added to this page, and the oldest tasks are removed from the collector to keep the size of the page to that allowed by SetCollectorPageSize. The "oldest task" is the one with the oldest creation time. The tasks in the returned page are unordered.

func (HistoryCollector) ReadNextTasks

func (h HistoryCollector) ReadNextTasks(ctx context.Context, maxCount int32) ([]types.TaskInfo, error)

ReadNextTasks reads the scrollable view from the current position. The scrollable position is moved to the next newer page after the read. No item is returned when the end of the collector is reached.

func (HistoryCollector) ReadPreviousTasks

func (h HistoryCollector) ReadPreviousTasks(ctx context.Context, maxCount int32) ([]types.TaskInfo, error)

ReadPreviousTasks reads the scrollable view from the current position. The scrollable position is then moved to the next older page after the read. No item is returned when the head of the collector is reached.

type Manager

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

func NewManager

func NewManager(c *vim25.Client) *Manager

NewManager creates a new task manager

func (Manager) CreateCollectorForTasks

func (m Manager) CreateCollectorForTasks(ctx context.Context, filter types.TaskFilterSpec) (*HistoryCollector, error)

CreateCollectorForTasks returns a task history collector, a specialized history collector that gathers TaskInfo data objects.

func (Manager) Reference

func (m Manager) Reference() types.ManagedObjectReference

Reference returns the task.Manager MOID

Jump to

Keyboard shortcuts

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