capsule

package
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxGoGraphInfoFilesV3           = MaxGoSelectedModulesV3
	MaxGoGraphInfoTotalSizeV3 int64 = 1 << 20
)
View Source
const (
	MaxGoGraphModFilesV3           = 128
	MaxGoGraphModTotalSizeV3 int64 = 1 << 20
)
View Source
const (
	MaxGoModulesV3                  = 64
	MaxGoModuleArtifactsV3          = 3
	MaxGoModuleTotalSizeV3    int64 = 64 << 20
	MaxGoModuleUnpackedSizeV3 int64 = 16 << 20
)
View Source
const (
	SchemaVersionV1 = 1
	SchemaVersionV2 = 2
	SchemaVersionV3 = 3

	// SchemaVersion remains v1 until the v2 writer and reader are ready.
	SchemaVersion = SchemaVersionV1
)
View Source
const (
	MaxWorkspaceV2Files     = 64
	MaxWorkspaceV2TotalSize = 14 << 20
)
View Source
const MaxCapsuleSize int64 = 16 << 20
View Source
const MaxCapsuleSizeV3 int64 = 96 << 20

MaxCapsuleSizeV3 bounds schema-v3 archives and prepared replay snapshots independently of legacy capsule formats.

View Source
const MaxGoDependencyDiagnosticsSize int64 = 8 << 20
View Source
const MaxGoSelectedModulesV3 = 128
View Source
const MaxManifestSize = 1 << 20 // 1 MiB
View Source
const MaxWorkspaceFileSize int64 = 10 << 20 // 10 MiB
View Source
const MaxWorkspaceV2PathBytes = 90
View Source
const MaxWorkspaceV3Files = 2048

Schema v3 can capture larger source trees without relaxing the existing schema-v2 workspace count limit.

View Source
const SupportedGoVersion = "1.26.6"

Variables

This section is empty.

Functions

func AddGoGraphArtifactsToStoreV3

func AddGoGraphArtifactsToStoreV3(
	manifest Manifest,
	goSum []byte,
	graphMods map[string][]byte,
	graphInfos map[string][]byte,
	store *ArtifactStoreV3,
) error

AddGoGraphArtifactsToStoreV3 appends validated graph-only .mod and .info artifacts to a store that may already contain full Go modules.

Graph metadata is deliberately bounded to its existing 1 MiB category budgets. The caller owns the store and closes it.

func BuildGoModuleSnapshotV3

func BuildGoModuleSnapshotV3(
	verified VerifiedCapsuleV3,
) ([]byte, error)

BuildGoModuleSnapshotV3 creates a deterministic TAR containing the verified Go module download cache.

It does not read artifacts from host staging.

func BuildWorkspaceSnapshotV3

func BuildWorkspaceSnapshotV3(
	verified VerifiedCapsuleV3,
) ([]byte, error)

BuildWorkspaceSnapshotV3 preserves the existing in-memory API.

func CompareGoModuleGraphV3

func CompareGoModuleGraphV3(
	expected []GoModuleV3,
	actual []GoModuleIdentityV3,
) error

CompareGoModuleGraphV3 requires an exact ordered match between manifest modules and the externally resolved Go module graph.

The main workspace module is excluded from actual.

func DiscoverGoEmbedFilesV3

func DiscoverGoEmbedFilesV3(
	workspaceRoot string,
	moduleCacheRoot string,
	sourceTarget ...GoBuildEnvironment,
) ([]string, error)

DiscoverGoEmbedFilesV3 finds embedded resources in packages selected by go build ./... for linux/amd64 and, when requested, darwin/arm64. The results are deduplicated.

Discovery uses the local Go toolchain without network module downloads. The subprocess is not a filesystem or network sandbox.

func DiscoverGoSourceFilesV3

func DiscoverGoSourceFilesV3(
	workspaceRoot string,
	moduleCacheRoot string,
	sourceTarget ...GoBuildEnvironment,
) ([]string, error)

DiscoverGoSourceFilesV3 discovers selected Go sources for Linux AMD64 and, when different, the supported source platform.

Discovery does not download modules. It is not a sandbox: only invoke it on workspaces trusted by the user.

func InspectGoModuleRequirements

func InspectGoModuleRequirements(workspace string) (bool, error)

InspectGoModuleRequirements reports whether go.mod declares module requirements. It does not resolve dependencies or contact a registry.

func ParseGoEmbedFilesV3

func ParseGoEmbedFilesV3(
	r io.Reader,
	workspaceRoot string,
) ([]string, error)

ParseGoEmbedFilesV3 extracts main-workspace embedded files from bounded go list -e -json ./... output. It does not read files.

func ParseGoSourceFilesV3

func ParseGoSourceFilesV3(
	r io.Reader,
	workspaceRoot string,
) ([]string, error)

ParseGoSourceFilesV3 selects Go source files from bounded go list -e -json ./... metadata. It does not read source contents.

GoFiles reflects the selected platform and build constraints. Incomplete package metadata is not automatically fatal because build failures can still have a valid GoFiles selection.

func PrepareGoModuleCacheV3

func PrepareGoModuleCacheV3(
	cacheRoot string,
	verified VerifiedCapsuleV3,
) error

PrepareGoModuleCacheV3 writes verified Go module artifacts into the standard Go module download-cache layout.

cacheRoot must exist and must be empty. The returned directory is suitable for a read-only Docker bind mount.

func RestoreWorkspace

func RestoreWorkspace(root string, verified VerifiedCapsule) error

func RestoreWorkspaceV2

func RestoreWorkspaceV2(root string, verified VerifiedCapsuleV2) error

func RestoreWorkspaceV3

func RestoreWorkspaceV3(
	workspaceRoot string,
	artifactsRoot string,
	verified VerifiedCapsuleV3,
) error

func SHA256

func SHA256(data []byte) string

func SplitExtendedGoArtifactsV3

func SplitExtendedGoArtifactsV3(
	manifest Manifest,
	artifacts map[string][]byte,
) (
	map[string][]byte,
	map[string][]byte,
	map[string][]byte,
	error,
)

SplitExtendedGoArtifactsV3 separates full module artifacts, additional graph .mod artifacts, and metadata-only .info files.

func SplitGoArtifactsV3

func SplitGoArtifactsV3(
	modules []GoModuleV3,
	graphFiles []GoGraphModFileV3,
	artifacts map[string][]byte,
) (map[string][]byte, map[string][]byte, error)

SplitGoArtifactsV3 separates declared selected-module artifacts from declared graph-only .mod artifacts. Unknown and duplicate artifact names are rejected.

func ValidateGoGraphInfoFilesV3

func ValidateGoGraphInfoFilesV3(
	files []GoGraphInfoFileV3,
	selected []GoModuleIdentityV3,
	full []GoModuleV3,
) error

ValidateGoGraphInfoFilesV3 validates metadata-only .info declarations against the complete selected module graph.

Full ZIP modules already contain their own .info artifacts and must never be duplicated here.

func ValidateGoGraphModFilesV3

func ValidateGoGraphModFilesV3(files []GoGraphModFileV3) error

ValidateGoGraphModFilesV3 validates metadata for additional go.mod files required to reconstruct a Go module graph offline.

These files are separate from selected modules and must contain only module metadata, never ZIP archives or executable content.

func ValidateGoModuleConsistencyV3

func ValidateGoModuleConsistencyV3(
	goMod []byte,
	modules []GoModuleV3,
) error

ValidateGoModuleConsistencyV3 checks that every root go.mod requirement exists in the manifest with the same version.

Additional manifest modules may be transitive dependencies. This check does not prove that the manifest contains the complete selected Go module graph.

func ValidateGoModulesV3

func ValidateGoModulesV3(modules []GoModuleV3) error

func ValidateGoSelectedMetadataCompletenessV3

func ValidateGoSelectedMetadataCompletenessV3(
	selected []GoModuleIdentityV3,
	full []GoModuleV3,
	infoFiles []GoGraphInfoFileV3,
) error

ValidateGoSelectedMetadataCompletenessV3 requires precisely one representation for every selected module:

  • a full ZIP/MOD/INFO module; or
  • an additional metadata-only .info file.

Legacy schema-v3 manifests retain their existing behavior.

func ValidateGoSelectedModuleConsistencyV3

func ValidateGoSelectedModuleConsistencyV3(
	goMod []byte,
	manifest Manifest,
) error

ValidateGoSelectedModuleConsistencyV3 checks root go.mod requirements against the effective selected module build list.

Legacy schema-v3 manifests derive that list from full ZIP modules. Extended manifests use GoSelectedModules.

func ValidateGoSelectedModulesV3

func ValidateGoSelectedModulesV3(
	selected []GoModuleIdentityV3,
	full []GoModuleV3,
) error

ValidateGoSelectedModulesV3 checks a complete, strictly ordered selected Go module build list, independently of ZIP availability.

An absent list means legacy schema-v3 behavior. An explicit list must include every module represented by a full ZIP artifact.

func ValidateGoWorkspaceV3

func ValidateGoWorkspaceV3(workingDir string) error

ValidateGoWorkspaceV3 rejects an active go.work configuration. An empty effective GOWORK means module mode is in use.

func ValidateWorkspacePath

func ValidateWorkspacePath(name string, mode fs.FileMode) error

func VerifyGoGraphInfoArtifactSetV3

func VerifyGoGraphInfoArtifactSetV3(
	files []GoGraphInfoFileV3,
	artifacts map[string][]byte,
) error

VerifyGoGraphInfoArtifactSetV3 verifies the complete set of metadata-only .info files declared by a manifest.

The caller must separately validate the manifest's selected graph and full ZIP module lists.

func VerifyGoGraphInfoFileV3

func VerifyGoGraphInfoFileV3(
	file GoGraphInfoFileV3,
	data []byte,
) error

VerifyGoGraphInfoFileV3 verifies a bounded metadata-only .info artifact. It establishes capsule integrity and identity consistency, not external module provenance.

func VerifyGoGraphModArtifactSetV3

func VerifyGoGraphModArtifactSetV3(
	files []GoGraphModFileV3,
	artifacts map[string][]byte,
	goSum []byte,
) error

VerifyGoGraphModArtifactSetV3 verifies additional module graph metadata independently from the selected module artifact set.

func VerifyGoGraphModFileV3

func VerifyGoGraphModFileV3(
	file GoGraphModFileV3,
	data []byte,
	goSum []byte,
) error

VerifyGoGraphModFileV3 verifies an additional module go.mod needed to reconstruct the dependency graph offline.

func VerifyGoModuleArtifactSetV3

func VerifyGoModuleArtifactSetV3(
	modules []GoModuleV3,
	artifacts map[string][]byte,
	goSum []byte,
) error

VerifyGoModuleArtifactSetV3 validates the entire artifact set. It rejects missing, extra, and incorrectly indexed artifacts.

func VerifyGoModuleArtifactsV3

func VerifyGoModuleArtifactsV3(
	mod GoModuleV3,
	artifacts map[string][]byte,
	goSum []byte,
) error

VerifyGoModuleArtifactsV3 preserves the single-module API.

func VerifyStagedWorkspaceV3

func VerifyStagedWorkspaceV3(
	root string,
	manifest Manifest,
) error

VerifyStagedWorkspaceV3 checks the restored workspace immediately before Docker receives it as a bind mount.

func VerifyWorkspaceFile

func VerifyWorkspaceFile(metadata FileMetadata, data []byte) error

func VerifyWorkspaceFileV2

func VerifyWorkspaceFileV2(metadata FileMetadata, data []byte) error

func Write

func Write(w io.Writer, manifest Manifest) error

func WriteFile

func WriteFile(output string, manifest Manifest, file WorkspaceFile) (err error)

func WriteGoModuleSnapshotFromStoreV3

func WriteGoModuleSnapshotFromStoreV3(
	w io.Writer,
	verified VerifiedStoredCapsuleV3,
) error

WriteGoModuleSnapshotFromStoreV3 streams a verified module-cache snapshot from disk-backed artifacts without loading ZIPs into RAM.

The caller must discard the destination if an error occurs.

func WriteGoModuleSnapshotV3

func WriteGoModuleSnapshotV3(
	w io.Writer,
	verified VerifiedCapsuleV3,
) error

WriteGoModuleSnapshotV3 writes a verified module-cache TAR to w. On error the destination may contain an incomplete archive; callers must discard it rather than pass it to Docker.

func WriteWithWorkspace

func WriteWithWorkspace(
	w io.Writer,
	manifest Manifest,
	file WorkspaceFile,
) error

func WriteWorkspaceFromStoreV3

func WriteWorkspaceFromStoreV3(
	w io.Writer,
	manifest Manifest,
	files []WorkspaceFile,
	store *ArtifactStoreV3,
) error

WriteWorkspaceFromStoreV3 emits a schema-v3 capsule using verified disk-backed dependency artifacts.

All validation completes before output begins. A destination write failure can leave a partial TAR; callers must discard it.

func WriteWorkspaceSnapshotV3

func WriteWorkspaceSnapshotV3(
	w io.Writer,
	verified VerifiedCapsuleV3,
) error

WriteWorkspaceSnapshotV3 writes a verified workspace TAR to w. On write failure, w may contain a partial archive. The caller must not publish or execute a partial archive.

func WriteWorkspaceV2

func WriteWorkspaceV2(
	w io.Writer,
	manifest Manifest,
	files []WorkspaceFile,
) error

func WriteWorkspaceV3

func WriteWorkspaceV3(
	w io.Writer,
	manifest Manifest,
	files []WorkspaceFile,
	artifacts map[string][]byte,
) error

WriteWorkspaceV3 writes a schema-v3 capsule containing a workspace and up to sixteen verified Go modules.

It validates all inputs before writing any bytes to w.

Types

type ArtifactStoreV3

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

ArtifactStoreV3 holds verified artifacts in a private temporary directory. It is not safe for concurrent use.

func NewArtifactStoreV3

func NewArtifactStoreV3(budget int64) (*ArtifactStoreV3, error)

NewArtifactStoreV3 creates a private store with a strict byte budget.

func (*ArtifactStoreV3) Close

func (s *ArtifactStoreV3) Close() error

Close invalidates the store and removes its temporary directory. Callers must close any readers previously returned by Open.

func (*ArtifactStoreV3) Open

func (s *ArtifactStoreV3) Open(name string) (*os.File, error)

Open returns a reader for a previously verified, published artifact.

func (*ArtifactStoreV3) Put

func (s *ArtifactStoreV3) Put(
	name string, src io.Reader, size int64, expectedSHA256 string,
) (resultErr error)

Put writes exactly size bytes, verifies SHA-256 and publishes atomically. On failure, no artifact is published or charged against the budget.

func (*ArtifactStoreV3) Used

func (s *ArtifactStoreV3) Used() int64

type Execution

type Execution struct {
	Argv            []string `json:"argv"`
	WorkingDir      string   `json:"working_dir"`
	ExitCode        int      `json:"exit_code"`
	Stdout          string   `json:"stdout"`
	Stderr          string   `json:"stderr"`
	StdoutTruncated bool     `json:"stdout_truncated"`
	StderrTruncated bool     `json:"stderr_truncated"`
}

type FileMetadata

type FileMetadata struct {
	Path   string `json:"path"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
}

type GoBuildEnvironment

type GoBuildEnvironment struct {
	GOOS       string `json:"goos"`
	GOARCH     string `json:"goarch"`
	CGOEnabled string `json:"cgo_enabled"`
	GOFLAGS    string `json:"goflags"`
}

func InspectGoBuildEnvironment

func InspectGoBuildEnvironment(workingDir string) (
	GoBuildEnvironment,
	error,
)

InspectGoBuildEnvironment reads the effective Go configuration. It does not modify the user's environment.

func (GoBuildEnvironment) ValidatePortableGoBuild

func (e GoBuildEnvironment) ValidatePortableGoBuild() error

ValidatePortableGoBuild checks the initial portability policy.

type GoDependencyState

type GoDependencyState string
const (
	GoDependenciesReady       GoDependencyState = "ready"
	GoDependenciesUnavailable GoDependencyState = "unavailable"
	GoDependenciesUnknown     GoDependencyState = "unknown"
)

type GoDependencyStatus

type GoDependencyStatus struct {
	State  GoDependencyState `json:"state"`
	Reason string            `json:"reason,omitempty"`
}

func InspectGoListOutput

func InspectGoListOutput(r io.Reader) (GoDependencyStatus, error)

InspectGoListOutput analyzes the structured output of "go list -deps -e -json ./...".

It does not execute Go, access the network, or change files.

func (GoDependencyStatus) Validate

func (s GoDependencyStatus) Validate() error

type GoGraphInfoFileV3

type GoGraphInfoFileV3 struct {
	Path     string           `json:"path"`
	Version  string           `json:"version"`
	Artifact GoModuleArtifact `json:"artifact"`
}

func ReadGoGraphInfoFilesForCaptureV3

func ReadGoGraphInfoFilesForCaptureV3(
	selected []GoModuleIdentityV3,
	full []GoModuleV3,
	moduleCacheRoot string,
) ([]GoGraphInfoFileV3, map[string][]byte, error)

ReadGoGraphInfoFilesForCaptureV3 reads metadata-only .info files from the local cache without downloading dependencies.

type GoGraphModFileV3

type GoGraphModFileV3 struct {
	Path     string           `json:"path"`
	Version  string           `json:"version"`
	Artifact GoModuleArtifact `json:"artifact"`
}

func ReadGoGraphModFilesForCaptureV3

func ReadGoGraphModFilesForCaptureV3(
	identities []GoModuleIdentityV3,
	goSum []byte,
	moduleCacheRoot string,
) ([]GoGraphModFileV3, map[string][]byte, error)

ReadGoGraphModFilesForCaptureV3 reads additional go.mod files from the local Go module cache without network access.

type GoModuleArtifact

type GoModuleArtifact struct {
	Path   string `json:"path"`
	Size   int64  `json:"size"`
	SHA256 string `json:"sha256"`
}

type GoModuleIdentityV3

type GoModuleIdentityV3 struct {
	Path    string
	Version string
}

GoModuleIdentityV3 represents one selected external module.

func EffectiveGoSelectedModulesV3

func EffectiveGoSelectedModulesV3(
	manifest Manifest,
) []GoModuleIdentityV3

EffectiveGoSelectedModulesV3 returns the explicit selected graph, or the complete ZIP-module list used by legacy schema-v3 capsules.

func ListGoBuildModulesV3

func ListGoBuildModulesV3(
	workspaceRoot string,
	moduleCacheRoot string,
	selected []GoModuleIdentityV3,
) ([]GoModuleIdentityV3, error)

ListGoBuildModulesV3 finds external modules actually used by go build ./... without allowing network module downloads.

This invokes the local Go toolchain. It is not a filesystem sandbox.

func ListGoGraphModRequirementsV3

func ListGoGraphModRequirementsV3(
	workspaceRoot string,
	moduleCacheRoot string,
	mainModulePath string,
	selected []GoModuleIdentityV3,
) ([]GoModuleIdentityV3, error)

ListGoGraphModRequirementsV3 resolves additional graph-only module versions without permitting network downloads.

This invokes the local Go toolchain, not a filesystem sandbox.

func ListGoModuleGraphV3

func ListGoModuleGraphV3(
	workspaceRoot string,
	moduleCacheRoot string,
) ([]GoModuleIdentityV3, error)

ListGoModuleGraphV3 determines selected Go modules without permitting Go module downloads.

This is not a filesystem sandbox. It invokes the local Go toolchain.

func ParseGoGraphModRequirementsV3

func ParseGoGraphModRequirementsV3(
	graph []byte,
	mainModulePath string,
	selected []GoModuleIdentityV3,
) ([]GoModuleIdentityV3, error)

ParseGoGraphModRequirementsV3 identifies module versions referenced by go mod graph that are not part of the selected module set.

The input must come from a separately bounded, offline Go command.

func ParseGoModuleGraphV3

func ParseGoModuleGraphV3(data []byte) ([]GoModuleIdentityV3, error)

ParseGoModuleGraphV3 parses the JSON stream produced by: go list -m -json all

It rejects replacements, invalid identities, duplicate paths, missing main modules, and oversized graphs.

func SelectGoBuildModulesV3

func SelectGoBuildModulesV3(
	r io.Reader,
	selected []GoModuleIdentityV3,
) ([]GoModuleIdentityV3, error)

SelectGoBuildModulesV3 extracts the external modules used by packages in a complete go list -deps -e -json ./... result.

The complete selected module graph is provided separately. Dependency loading errors are never treated as an empty or successful dependency selection.

func SelectVerifiedGoGraphModsV3

func SelectVerifiedGoGraphModsV3(
	selected []GoModuleIdentityV3,
	full []GoModuleV3,
	historical []GoModuleIdentityV3,
	goSum []byte,
) ([]GoModuleIdentityV3, error)

SelectVerifiedGoGraphModsV3 selects additional .mod versions whose /go.mod checksums are declared in the captured go.sum.

Full ZIP modules already contain a verified .mod. Metadata-only selected modules and historical graph versions may need .mod.

type GoModuleV3

type GoModuleV3 struct {
	Path      string             `json:"path"`
	Version   string             `json:"version"`
	Artifacts []GoModuleArtifact `json:"artifacts"`
}

func ReadGoDependenciesForCaptureV3

func ReadGoDependenciesForCaptureV3(
	goMod []byte,
	goSum []byte,
	moduleCacheRoot string,
) ([]GoModuleV3, map[string][]byte, error)

ReadGoDependenciesForCaptureV3 captures zero or one direct Go dependency. It never downloads modules.

func ReadGoModuleArtifactSetForCaptureV3

func ReadGoModuleArtifactSetForCaptureV3(
	modules []GoModuleIdentityV3,
	goSum []byte,
	moduleCacheRoot string,
) ([]GoModuleV3, map[string][]byte, error)

ReadGoModuleArtifactSetForCaptureV3 reads selected Go module artifacts from the local module download cache.

It never downloads modules or accesses the network. Modules must have unique paths in ascending order.

func ReadGoModuleArtifactSetToStoreV3

func ReadGoModuleArtifactSetToStoreV3(
	modules []GoModuleIdentityV3,
	goSum []byte,
	moduleCacheRoot string,
	store *ArtifactStoreV3,
) ([]GoModuleV3, error)

ReadGoModuleArtifactSetToStoreV3 copies selected Go module artifacts from the local cache to an existing private store.

No downloads are performed. ZIP contents are never accumulated in memory. The caller owns and closes the store.

Use a fresh store; partial artifacts on error belong to the caller.

func ReadGoModuleArtifactsForCaptureV3

func ReadGoModuleArtifactsForCaptureV3(
	goMod []byte,
	goSum []byte,
	moduleCacheRoot string,
) (GoModuleV3, map[string][]byte, error)

ReadGoModuleArtifactsForCaptureV3 reads one direct Go dependency from the local Go module download cache.

It does not download modules or access the network.

type Manifest

type Manifest struct {
	SchemaVersion     int                  `json:"schema_version"`
	Execution         Execution            `json:"execution"`
	Platform          Platform             `json:"platform"`
	Workspace         Workspace            `json:"workspace"`
	Runtime           *Runtime             `json:"runtime,omitempty"`
	GoBuildEnv        *GoBuildEnvironment  `json:"go_build_env,omitempty"`
	GoDependencies    *GoDependencyStatus  `json:"go_dependencies,omitempty"`
	GoModules         []GoModuleV3         `json:"go_modules,omitempty"`
	GoSelectedModules []GoModuleIdentityV3 `json:"go_selected_modules,omitempty"`
	GoGraphInfoFiles  []GoGraphInfoFileV3  `json:"go_graph_info_files,omitempty"`
	GoGraphModFiles   []GoGraphModFileV3   `json:"go_graph_mod_files,omitempty"`
}

func ReadManifest

func ReadManifest(filename string) (Manifest, error)

func (Manifest) Validate

func (m Manifest) Validate() error

type Platform

type Platform struct {
	OS           string `json:"os"`
	Architecture string `json:"architecture"`
}

type Runtime

type Runtime struct {
	Kind    string `json:"kind"`
	Version string `json:"version"`
}

func DetectRuntime

func DetectRuntime(argv []string, workingDir string) *Runtime

DetectRuntime identifies supported toolchains for capture. Unknown commands return nil, preserving legacy behavior.

func (Runtime) Validate

func (r Runtime) Validate() error

type VerifiedCapsule

type VerifiedCapsule struct {
	Manifest Manifest
	File     WorkspaceFile
}

func ReadVerified

func ReadVerified(filename string) (VerifiedCapsule, error)

type VerifiedCapsuleV2

type VerifiedCapsuleV2 struct {
	Manifest Manifest
	Files    []WorkspaceFile
}

func ReadVerifiedV2

func ReadVerifiedV2(filename string) (VerifiedCapsuleV2, error)

type VerifiedCapsuleV3

type VerifiedCapsuleV3 struct {
	Manifest  Manifest
	Files     []WorkspaceFile
	Artifacts map[string][]byte
}

func ReadVerifiedV3

func ReadVerifiedV3(filename string) (VerifiedCapsuleV3, error)

type VerifiedStoredCapsuleV3

type VerifiedStoredCapsuleV3 struct {
	Manifest Manifest
	Files    []WorkspaceFile
	Store    *ArtifactStoreV3
}

VerifiedStoredCapsuleV3 owns a disk-backed artifact store. The caller must call Close when finished.

func ReadVerifiedToStoreV3

func ReadVerifiedToStoreV3(
	filename string,
) (result VerifiedStoredCapsuleV3, resultErr error)

ReadVerifiedToStoreV3 reads a schema-v3 capsule and places dependencies on disk instead of retaining their ZIP bytes in RAM.

Workspace files remain bounded in memory. All dependencies are verified before this function succeeds.

func (*VerifiedStoredCapsuleV3) Close

func (v *VerifiedStoredCapsuleV3) Close() error

type Workspace

type Workspace struct {
	Files []FileMetadata `json:"files"`
}

func (Workspace) Validate

func (w Workspace) Validate() error

type WorkspaceFile

type WorkspaceFile struct {
	Path string
	Data []byte
	Mode fs.FileMode
}

func ReadWorkspaceFile

func ReadWorkspaceFile(root, name string) (WorkspaceFile, error)

func ReadWorkspaceFilesV2

func ReadWorkspaceFilesV2(root string, paths []string) ([]WorkspaceFile, error)

func ReadWorkspaceFilesV3

func ReadWorkspaceFilesV3(root string, paths []string) ([]WorkspaceFile, error)

Source Files

Jump to

Keyboard shortcuts

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