payload

package
v0.0.0-...-5490f4d Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloseFunc

type CloseFunc func() error

CloseFunc closes a reader.

type CloudStorage

type CloudStorage struct {
	Token    *oauth2.Token
	Artifact *artifact.GSArtifact
	// contains filtered or unexported fields
}

CloudStorage backed payload.

func (*CloudStorage) CloseClient

func (c *CloudStorage) CloseClient() error

CloseClient implements Payload.

func (*CloudStorage) Compression

func (c *CloudStorage) Compression() artifact.Compression

Compression implements Payload.

func (*CloudStorage) InitClient

func (c *CloudStorage) InitClient(ctx context.Context) error

InitClient implements Payload.

func (*CloudStorage) NewClient

func (c *CloudStorage) NewClient(ctx context.Context) (*storage.Client, error)

NewClient returns a new client with the token on c.

func (*CloudStorage) OpenImage

func (c *CloudStorage) OpenImage(ctx context.Context, image artifact.ImageID) (io.ReadCloser, int64, error)

OpenImage implements Payload.

type HTTP

type HTTP struct {
	// URL of zstd-compressed images accessible from dut-agent.
	Kernel   string `json:"kernel"`
	Rootfs   string `json:"rootfs"`
	Stateful string `json:"stateful"`
}

HTTP backed payload.

func (*HTTP) CloseClient

func (h *HTTP) CloseClient() error

CloseClient implements Payload.

func (*HTTP) Compression

func (h *HTTP) Compression() artifact.Compression

Compression implements Payload.

func (*HTTP) InitClient

func (h *HTTP) InitClient(ctx context.Context) error

InitClient implements Payload.

func (*HTTP) OpenImage

func (h *HTTP) OpenImage(ctx context.Context, image artifact.ImageID) (r io.ReadCloser, size int64, err error)

OpenImage implements Payload.

type OneOf

type OneOf struct {
	CloudStorage *CloudStorage `json:"cloud_storage"`
	HTTP         *HTTP         `json:"http"`
}

OneOf the Payloads for dut-agent to flash. One of the payload types must be set.

func (*OneOf) Instance

func (p *OneOf) Instance() (Payload, error)

Instance returns the Payload instance.

type Payload

type Payload interface {
	// InitClient initializes the client associated with this Provider.
	InitClient(ctx context.Context) error
	// CloseClient closes the client associated with this Provider.
	CloseClient() error

	// OpenImage opens the image and returns the reader and the size of the compressed image.
	OpenImage(ctx context.Context, image artifact.ImageID) (r io.ReadCloser, size int64, err error)

	// Compression returns the compression kind of the images.
	Compression() artifact.Compression
}

Payload is an abstraction over a set of Artifacts to flash to the device.

Jump to

Keyboard shortcuts

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