Documentation
¶
Index ¶
- func BuildCommand() []string
- func BuildMounts(pakCachePath, bundlePath, storePath, dlCachePath, builderPath string) []backend.MountEntry
- func CreateLibraryDir(paths Paths) error
- func DeleteFiles(paths Paths)
- func DetectEntrypoint(unpackedPath string) string
- func EnforceRetention(database *db.DB, base, appID string, activeBundleID string, retention int) []string
- func SpawnRestore(params RestoreParams) <-chan struct{}
- func UnpackArchive(paths Paths) error
- func ValidateEntrypoint(paths Paths) error
- func WriteArchive(paths Paths, r io.Reader) error
- type Paths
- type RestoreParams
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 ¶
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
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 ¶
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 ¶
ValidateEntrypoint checks that the unpacked bundle contains app.R at the top level.
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 ¶
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.