uploader

package
v0.0.0-...-12b1b93 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package uploader uploads local files/directories to CAS.

Index

Constants

View Source
const (
	// Sha256HeaderID is a custom Header ID for the `extra` field in the file header to store the SHA
	// checksum. It is defined in build/soong/zip/zip.go
	Sha256HeaderID = 0x4967

	// Sha256HeaderSignature is the signature to verify that the extra data block is used to store the
	// SHA checksum. It is defined in build/soong/zip/zip.go
	Sha256HeaderSignature = 0x9514

	// XattrDigestName is the xattr name for the object digest. It is used by Remote API Sdks to get
	// the file digest without loading actual file content.
	XattrDigestName = "user.digest.sha256"

	// XattrSrcZipPath is the xattr name for the path in zip file. It maps the extracted file to the
	// compressed file inside the original zip.
	XattrSrcZipPath = "user.zip_src"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonConfig

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

CommonConfig is the common configurations used for all kinds of uploders

func NewCommonConfig

func NewCommonConfig(ctx context.Context, client *client.Client, excludeFilters []string, dumpFileDetails string) *CommonConfig

NewCommonConfig creates a common CAS uploader configuration.

type DirUploader

type DirUploader struct {
	CommonConfig
	// contains filtered or unexported fields
}

DirUploader is the uploader to upload a directory to CAS.

func (*DirUploader) DoUpload

func (du *DirUploader) DoUpload() (digest.Digest, error)

DoUpload uploads the given directories to CAS, and returns the digest of the root directory.

type Uploader

type Uploader interface {
	// DoUpload uploads files/directories to CAS, and returns the digest of the root directory.
	DoUpload() (digest.Digest, error)
}

Uploader is the common interface implemented by all kind of uploaders.

func NewDirUploader

func NewDirUploader(config *CommonConfig, dirPath string, fileLoader fileLoader) Uploader

NewDirUploader creates a new directory uploader to upload a directory to CAS.

func NewZipUploader

func NewZipUploader(config *CommonConfig, zipPath string) Uploader

NewZipUploader creates

type ZipUploader

type ZipUploader struct {
	CommonConfig
	// contains filtered or unexported fields
}

ZipUploader is the uploader to uploader the a zip

func (*ZipUploader) DoUpload

func (zu *ZipUploader) DoUpload() (digest.Digest, error)

DoUpload uploads the unarchived zip file to CAS, and returns the digest of the root directory.

Jump to

Keyboard shortcuts

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