snapshot

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package snapshot encodes one verified skillsync bundle as a reproducible tar artifact and exposes the same descriptor/content pair for embedding.

Index

Constants

View Source
const DefaultAssetName = "skillsync-bundle.tar"

DefaultAssetName is the stable GitHub Release asset name for packed bundles.

View Source
const DefaultDescriptorAssetName = "skillsync-bundle.json"
View Source
const DefaultMaxBytes int64 = 16 << 20
View Source
const DefaultMaxFiles = 256

DefaultMaxFiles and DefaultMaxBytes are the consumer bounds applied when a caller passes zero-value Limits to Unpack.

Variables

This section is empty.

Functions

func DescriptorJSON

func DescriptorJSON(descriptor skillsync.BundleDescriptor, content fs.FS) ([]byte, error)

DescriptorJSON returns canonical descriptor metadata for a companion release asset and normalizes executable modes discovered in local source content.

func Pack

func Pack(descriptor skillsync.BundleDescriptor, content fs.FS) ([]byte, error)

Pack emits byte-for-byte reproducible tar content. HTTPS transport and the descriptor digest provide integrity; this format does not claim signatures.

func Unpack

func Unpack(artifact []byte, limits Limits) (skillsync.BundleDescriptor, fs.FS, error)

Unpack validates an artifact completely before returning a bundle.

func Write

func Write(w io.Writer, descriptor skillsync.BundleDescriptor, content fs.FS) error

Write emits a reproducible archive to w. It is useful to release producers that upload an artifact without first duplicating it on disk.

func WriteEmbedDirectory

func WriteEmbedDirectory(dir string, descriptor skillsync.BundleDescriptor, content fs.FS) error

WriteEmbedDirectory materializes the exact descriptor/content pair for a caller's go:embed directory. The destination must not already exist. A write failure may leave partial output in this newly created directory; callers must discard that output before retrying or embedding it.

Types

type Captured

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

Captured is an immutable, mode-preserving copy of a source filesystem. A producer captures once, verifies that copy, then uses it for every output so a changing filesystem cannot make the archive and descriptor disagree.

func Capture

func Capture(content fs.FS) (Captured, error)

Capture reads every regular source file once and retains its bytes and mode. Symlinks, special entries, and unsafe paths are rejected before a caller can publish any output.

func (Captured) DescriptorJSON

func (c Captured) DescriptorJSON(descriptor skillsync.BundleDescriptor) ([]byte, error)

DescriptorJSON returns canonical descriptor metadata for a captured image.

func (Captured) Digest

func (c Captured) Digest(executablePaths []string) (string, error)

Digest computes the mode-aware digest from the captured bytes, using the shared skillsync digest implementation.

func (Captured) NormalizeDescriptor

func (c Captured) NormalizeDescriptor(descriptor skillsync.BundleDescriptor) (skillsync.BundleDescriptor, error)

NormalizeDescriptor binds descriptor metadata to the captured bytes. It is intentionally the one validation point shared by archive and embed output.

func (Captured) Pack

func (c Captured) Pack(descriptor skillsync.BundleDescriptor) ([]byte, error)

Pack emits a reproducible archive from one captured source image.

func (Captured) Write

func (c Captured) Write(w io.Writer, descriptor skillsync.BundleDescriptor) error

Write emits a reproducible archive from one captured source image.

func (Captured) WriteEmbedDirectory

func (c Captured) WriteEmbedDirectory(dir string, descriptor skillsync.BundleDescriptor) error

type Limits

type Limits struct {
	MaxFiles int
	MaxBytes int64
}

Limits bounds untrusted release artifact processing.

Jump to

Keyboard shortcuts

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