Back to godoc.org

Package isolated

v0.0.0-...-1557bcf
Latest Go to latest

The latest major version is .

Published: Aug 13, 2020 | License: Apache-2.0 | Module: github.com/luci/luci-go

Index

func Archive

func Archive(ctx context.Context, arch *archiver.Archiver, opts *ArchiveOptions) *archiver.PendingItem

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 *archiver.Archiver, baseDir string, files []string) ([]*archiver.PendingItem, error)

ArchiveFiles uploads given files using given archiver.

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

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.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier