Documentation
¶
Index ¶
Constants ¶
const AssetTypeCommand = "asset-type"
const TaskInfosCommand = "task-infos"
Variables ¶
This section is empty.
Functions ¶
func NewAssetTypeCmd ¶
func NewTaskInfosCommand ¶
NewTaskInfosCommand returns a command that marshals the provided taskInfos as JSON and prints it to stdout.
func UpgradeConfigError ¶
Types ¶
type Asset ¶
type Asset struct {
// AssetPath is the path to the asset.
AssetPath string
// AssetType is the type of asset.
AssetType AssetType
// TaskInfos is the information for asset-provided tasks. nil if the asset does not have any asset-provided tasks.
TaskInfos *TaskInfos
}
Asset represents a distgo asset.
type AssetTaskInfo ¶
type AssetTaskInfo struct {
AssetPath string
AssetType AssetType
AssetName string
TaskInfo distgotaskprovider.TaskInfo
}
AssetTaskInfo represents a single TaskInfo provided by an asset. Packages together information from the Asset and AssetInfos structs for a particular TaskInfo.
func GetTaskProviderVerifyTasksFromAssets ¶
func GetTaskProviderVerifyTasksFromAssets(assets Assets) []AssetTaskInfo
GetTaskProviderVerifyTasksFromAssets returns a slice that contains the VerifyTaskInfo for all the provided assets.
type Assets ¶
type Assets struct {
// contains filtered or unexported fields
}
Assets represents a collection of distgo assets.
func LoadAssets ¶
LoadAssets loads the assets at the specified path and returns a map from AssetType to the paths for the assets of that type. Returns an error if any of the provided assets do not respond to the command that queries for their type or if the returned type is not a recognized asset type.
func (*Assets) AssetsWithTaskInfos ¶
AssetsWithTaskInfos returns all the Assets that have a non-nil TaskInfos field. The assets in the returned slice are ordered by the natural ordering of AssetType and, within a type, occur in the same order as they occur in the value slice of the assets map.
func (*Assets) GetAssetPathsForType ¶
GetAssetPathsForType returns the paths to the asset of the provided type.
type TaskInfos ¶
type TaskInfos struct {
// AssetName is the name of the asset. Must be globally unique for an asset of a given type.
// Should be human-readable and short (and use kebab-case if it has multiple components), as this value is used as
// part of the fully qualified asset-provided task command.
AssetName string `json:"asset-name"`
// TaskInfos specifies the tasks provided by the asset.
TaskInfos map[string]distgotaskprovider.TaskInfo `json:"task-infos"`
}
func GetTaskInfos ¶
GetTaskInfos returns the TaskInfos returned by unmarshalling the JSON returned by invoking the TaskInfosCommand on the asset at the specified path. Returns nil if the asset does not provide any tasks (including returning an error when invoking the command on the asset at the provided path). Returns an error only in the case where invoking the TaskInfosCommand on the asset return with an exit code of 0 but produces output that cannot be unmarshalled as a *TaskInfos from JSON.