bundle

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCommand added in v0.0.3

func BuildCommand() []string

BuildCommand returns the R command that runs inside the build container. The four-phase store-aware build script:

  • Phase 1: lockfile_create (pak resolves + solves)
  • Phase 2: by-builder store populate (pre-populate from store)
  • Phase 3: lockfile_install (install store misses)
  • Phase 4: by-builder store ingest (ingest into store)

Exported for use by the refresh pipeline (server/refresh.go).

func BuildMounts added in v0.0.3

func BuildMounts(
	pakCachePath, bundlePath, storePath, dlCachePath, builderPath string,
) []backend.MountEntry

BuildMounts returns the mount entries for the store-aware build container. Exported for use by the refresh pipeline (server/refresh.go).

func CreateLibraryDir

func CreateLibraryDir(paths Paths) error

CreateLibraryDir creates the output directory for dependency restoration.

func DeleteFiles

func DeleteFiles(paths Paths)

DeleteFiles removes a bundle's archive, unpacked dir, and library dir. Errors are logged but do not fail the operation.

func DetectEntrypoint added in v0.0.3

func DetectEntrypoint(unpackedPath string) string

DetectEntrypoint returns the entrypoint file name. Bundles must contain app.R — this is the only supported entrypoint.

func EnforceRetention

func EnforceRetention(database *db.DB, base, appID string, activeBundleID string, retention int) []string

EnforceRetention deletes the oldest non-active bundles when the count exceeds retention. Returns IDs of deleted bundles.

func SpawnRestore

func SpawnRestore(params RestoreParams) <-chan struct{}

SpawnRestore launches the restore pipeline in a background goroutine. Returns a channel that is closed when the goroutine finishes.

func UnpackArchive

func UnpackArchive(paths Paths) error

UnpackArchive decompresses the tar.gz archive into the unpacked directory. Extraction is capped at maxDecompressedSize total bytes to prevent gzip/tar bomb attacks.

func ValidateEntrypoint

func ValidateEntrypoint(paths Paths) error

ValidateEntrypoint checks that the unpacked bundle contains app.R at the top level.

func WriteArchive

func WriteArchive(paths Paths, r io.Reader) error

WriteArchive streams r to a temp file, then atomically renames it to the archive path. Creates the app directory if needed.

Types

type Paths

type Paths struct {
	Base     string // {base}/{app_id}/bundles/{bundle_id}/ — parent for bundle artifacts
	Archive  string // {base}/{app_id}/{bundle_id}.tar.gz
	Unpacked string // {base}/{app_id}/{bundle_id}/
	Library  string // {base}/{app_id}/{bundle_id}_lib/
}

Paths holds the filesystem locations for a bundle.

func NewBundlePaths

func NewBundlePaths(base, appID, bundleID string) Paths

NewBundlePaths constructs paths for a bundle. Single source of truth for the on-disk layout.

type RestoreParams

type RestoreParams struct {
	Ctx              context.Context // optional; defaults to context.Background()
	Backend          backend.Backend
	DB               *db.DB
	Tasks            *task.Store
	Sender           task.Sender
	AppID            string
	BundleID         string
	Paths            Paths
	Image            string
	PakVersion       string // "stable" (default), or pinned version
	PakCachePath     string // base directory for pak cache
	BuilderVersion   string // by-builder binary version
	BuilderCachePath string // by-builder cache directory
	Retention        int
	BasePath         string // bundle_server_path for retention cleanup
	Store            *pkgstore.Store
	AuditLog         *audit.Log
	AuditActor       string             // sub of the user who triggered the upload
	Metrics          *telemetry.Metrics // records restore duration + outcome
	WG               *sync.WaitGroup    // if non-nil, Add(1) before goroutine, Done() on exit
}

RestoreParams holds everything the restore goroutine needs.

Jump to

Keyboard shortcuts

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