common

package
v0.0.0-...-75e4d2d Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Base task identifiers and image metadata keys.
	CrosProvision    = "cros-provision"
	AndroidProvision = "android-provision"
	CrosDut          = "cros-dut"
	RdbPublish       = "rdb-publish"

	// Device base identifiers.
	Primary   = "primary"
	Companion = "companion"

	// Commonly used Dynamic Dependecy keys.
	ServiceAddress = "serviceAddress"
)

Constants relating to dynamic dependency storage.

Variables

View Source
var (
	PrimaryDevice            = NewPrimaryDeviceIdentifier().GetDevice()
	CompanionDevices         = NewCompanionDeviceIdentifier("all").GetDevice()
	CompanionDevicesMetadata = NewCompanionDeviceIdentifier("all").GetDeviceMetadata()
)

Functions

func AppendTaskWrapper

func AppendTaskWrapper(focalTaskFinder *api.FocalTaskFinder) interfaces.InsertInstructionGetter

AppendTaskWrapper creates an insert action that appends the payload task.

func ConvertProtoMapToAnyMap

func ConvertProtoMapToAnyMap(m map[string]proto.Message) (map[string]*anypb.Any, error)

ConvertProtoMapToAnyMap marshals each provided proto message into an anypb Any.

func FindBeginning

func FindBeginning() *api.FocalTaskFinder

FindBeginning builds out a `Beginning` focal task finder. Index = 0.

func FindByDynamicIdentifier

func FindByDynamicIdentifier(dynamicId string) *api.FocalTaskFinder

FindByDynamicIdentifier builds out a focal task finder that searches for the task that has the dynamic id provided.

func FindEnd

func FindEnd() *api.FocalTaskFinder

FindEnd builds out an `End` focal task finder. Index = len(taskList)-1.

func FindFirst

func FindFirst(taskType api.FocalTaskFinder_TaskType) *api.FocalTaskFinder

FindFirst builds out a `First` focal task finder for a given task type.

func FindLast

func FindLast(taskType api.FocalTaskFinder_TaskType) *api.FocalTaskFinder

FindLast builds out a `Last` focal task finder for a given task type.

func GenerateDynamicDeps

func GenerateDynamicDeps(rpc string, depMap map[string]string, format string) []*api.DynamicDep

generateDynamicDeps converts a UserContainerRequest's DynamicInputs into a dynamic dependency list.

func InsertActionWrapper

func InsertActionWrapper(insertType api.UpdateAction_Insert_InsertType, focalTaskFinder *api.FocalTaskFinder) interfaces.InsertInstructionGetter

InsertActionWrapper provides a wrapper for creating an insert action for a task based on the desired insert type and focal task finder.

func ModifyActionWrapper

func ModifyActionWrapper(focalTaskFinder *api.FocalTaskFinder) interfaces.ModifyActionGetter

ModifyActionWrapper provides a wrapper for creating a modify action for a list of modifications.

func PrependTaskWrapper

func PrependTaskWrapper(focalTaskFinder *api.FocalTaskFinder) interfaces.InsertInstructionGetter

PrependTaskWrapper creates an insert action that prepends the payload task.

func RemoveAction

func RemoveAction(focalTaskFinder *api.FocalTaskFinder) *api.UserDefinedDynamicUpdate

RemoveAction creates a dynamic update for removing the task found by the focal task finder.

func ReplaceTaskWrapper

func ReplaceTaskWrapper(focalTaskFinder *api.FocalTaskFinder) interfaces.InsertInstructionGetter

ReplaceTaskWrapper creates an insert action that replaces with the payload task.

func SetPlaceholder

func SetPlaceholder(referenceKey string) string

SetPlaceholder returns the reference key with the defined placeholder format.

Types

type DeviceIdentifier

type DeviceIdentifier struct {
	Id string
}

DeviceIdentifier is the baseline structure for handling dynamic identities for devices.

func DeviceIdentifierFromString

func DeviceIdentifierFromString(str string) *DeviceIdentifier

DeviceIdentifierFromString initializes the DeviceIdentifier from a string.

func NewCompanionDeviceIdentifier

func NewCompanionDeviceIdentifier(board string) *DeviceIdentifier

NewCompanionDeviceIdentifier initializes a DeviceIdentifier for a companion device, postfixed with the board.

func NewPrimaryDeviceIdentifier

func NewPrimaryDeviceIdentifier() *DeviceIdentifier

NewPrimaryDeviceIdentifier initializes a DeviceIdentifier for the primary device.

func (*DeviceIdentifier) AddPostfix

func (id *DeviceIdentifier) AddPostfix(postfix string) *DeviceIdentifier

AddPostfix appends a value to the DeviceIdentifier.

func (*DeviceIdentifier) GetCrosDutServer

func (id *DeviceIdentifier) GetCrosDutServer() string

GetCrosDutServer returns the format for retrieving the device's specificed cros-dut server ip.

func (*DeviceIdentifier) GetDevice

func (id *DeviceIdentifier) GetDevice(innerValueCallChain ...string) string

GetDevice returns the format for retrieving the device's dut topology value, and allows for calling interior fields.

func (*DeviceIdentifier) GetDeviceMetadata

func (id *DeviceIdentifier) GetDeviceMetadata(innerValueCallChain ...string) string

GetDeviceMetadata returns the format for retrieving the device's metadata information.

type TaskIdentifier

type TaskIdentifier struct {
	Id string
}

TaskIdentifier is the baseline structure for handling dynamic identities for tasks.

func NewTaskIdentifier

func NewTaskIdentifier(taskBaseIdentifier string) *TaskIdentifier

NewTaskIdentifier initializes the TaskIdentifier from a string.

func (*TaskIdentifier) AddDeviceId

func (id *TaskIdentifier) AddDeviceId(deviceId *DeviceIdentifier) *TaskIdentifier

AddDeviceId postfixes the task id with a device id. Important to use when working with provisions or other device targeting tasks.

func (*TaskIdentifier) GetRpcRequest

func (id *TaskIdentifier) GetRpcRequest(rpc string, innerValueCallChain ...string) string

GetRpcRequest returns the format for accessing requests from a task.

func (*TaskIdentifier) GetRpcResponse

func (id *TaskIdentifier) GetRpcResponse(rpc string, innerValueCallChain ...string) string

GetRpcResponse returns the format for accessing responses from a task.

Jump to

Keyboard shortcuts

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