isolated

package
v0.0.0-...-51f9457 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Archive

Archive uses the given archiver and options to constructed an isolated file, and uploads it and its dependencies.

Archive returns the digest of the composite isolated file.

func ArchiveFiles

func ArchiveFiles(ctx context.Context, arch *pipeline.Archiver, baseDir string, files []string) ([]*pipeline.PendingItem, error)

ArchiveFiles uploads given files using given pipeline.

This is thin wrapper of Archive. Note that this function may have large number of concurrent RPCs to isolate server.

Types

type ArchiveOptions

type ArchiveOptions struct {
	// Files is a map of working directories to files relative to that working
	// directory.
	//
	// The working directories may be relative to CWD.
	Files ScatterGather

	// Dirs is a map of working directories to directories relative to that
	// working directory.
	//
	// The working directories may be relative to CWD.
	Dirs ScatterGather

	// Isolated is the display name of the isolated to upload.
	Isolated string

	// LeakIsolated is handle to a place where Archive will write
	// the encoded bytes of the isolated file.
	LeakIsolated io.Writer
}

ArchiveOptions for archiving trees.

type ScatterGather

type ScatterGather map[string]string

ScatterGather represents a mapping of working directories to relative paths.

The purpose is to represent some notion of "local" vs. "archived" paths. All relative paths are relative to both their corresponding working directories as well as the root of an archive.

filepath.Join(working dir, relative path) == location of file or directory on the system.

relative path == location of file or directory in an archive.

Notably, in such a design, we may not have more than one copy of a relative path in the archive, because there is a conflict. In order to efficiently check this case at the expense of extra memory, ScatterGather actually stores a mapping of relative paths to working directories.

func (ScatterGather) Add

func (sc ScatterGather) Add(wd string, rel string) error

Add adds a (working directory, relative path) pair to the ScatterGather.

Add returns an error if the relative path was already added.

func (*ScatterGather) Set

func (sc *ScatterGather) Set(value string) error

Set implements the flags.Var interface.

func (*ScatterGather) String

func (sc *ScatterGather) String() string

String implements the Stringer interface.

Jump to

Keyboard shortcuts

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