Documentation
¶
Overview ¶
Package workspace bounds temporary worker storage independently of job output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Root string
Policy Policy
Job sandbox.Job
ServiceMemory uint64
Deadline time.Time
Authorize func(context.Context, sandbox.Job) error
}
Config binds workspace storage to one signed job and its original deadline. Root must already exist with root ownership and mode 0o700. Authorize must check current host grants for this exact job and honor context cancellation.
type Paths ¶
type Paths struct {
JobID id.ID
JobDigest string
Directory, Images, Inputs, Bundle, Runtime, Scratch string
}
Paths names host-controlled staging and guest scratch directories. They carry no authority; call Check before using them for staging, execution or export.
type Policy ¶
type Policy struct {
StagingBytes int64 `json:"staging_bytes"`
StagingInodes int64 `json:"staging_inodes"`
ScratchInodes int64 `json:"scratch_inodes"`
ReserveMemoryBytes int64 `json:"reserve_memory_bytes"`
}
Policy is host configuration, pinned by the worker launch profile. Staging covers image, input, bundle and runtime files; scratch is a separate filesystem bounded by the signed job. ReserveMemoryBytes leaves room for worker overhead.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace owns one exclusive job directory and two quota-enforced filesystems. It never reuses retained job directories. Failed cleanup requires retry or independent service cleanup before the retained directory can be reclaimed.
func Create ¶
Create requires the exact Linux worker containment and a private mount namespace. A nonnil workspace returned with an error has unresolved cleanup; it cannot be used and the caller must retain it for Close or exit the worker.
func (*Workspace) Check ¶
Check revalidates current authority, containment and storage without extending the signed deadline. It serializes with Close so cleanup cannot overlap it.
func (*Workspace) Close ¶
Close retries normal unmount and removes only owned, empty mountpoints and the original job directory. It ignores execution grants and uses a fresh caller context capped at ten seconds; cancellation of the job does not waive cleanup.
func (*Workspace) Paths ¶
Paths returns a snapshot only while setup is complete and cleanup has not begun.
func (*Workspace) VerifyStorage ¶
VerifyStorage checks the retained filesystem identity without granting execution authority. Runtime cleanup may call it after grants or the signed deadline expire, using its own independent bounded context.