Documentation
¶
Overview ¶
Package workspacefs defines the independent workspace filesystem boundary. Its owning document is docs/workspace-provider.md. Core owns identities and lifecycle; adapters own filesystem configuration, receipts and path resolution.
Index ¶
- Variables
- func ValidateAttachment(reference Reference, configuration Configuration, attachment Attachment) error
- func ValidateCombination(requirements Requirements, declaration Declaration, ...) error
- type Adapter
- type Attachment
- type AttachmentKind
- type Binding
- type Configuration
- type ConfigurationRecord
- type Control
- type Declaration
- type Directory
- type Reference
- type Requirements
- type Resolver
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalid = errors.New("invalid workspace filesystem request") ErrOwnership = errors.New("workspace filesystem ownership mismatch") ErrUnconfirmed = errors.New("workspace filesystem mutation outcome unconfirmed") ErrNotFound = errors.New("workspace filesystem object not found") ErrUnsupported = errors.New("unsupported workspace filesystem combination") )
Functions ¶
func ValidateAttachment ¶
func ValidateAttachment(reference Reference, configuration Configuration, attachment Attachment) error
ValidateAttachment checks the shared envelope only. It cannot establish native ownership: the adapter must validate its parameters, receipt and owned resource.
func ValidateCombination ¶
func ValidateCombination(requirements Requirements, declaration Declaration, requestedCapacityMiB uint32) error
ValidateCombination runs before any allocation. Zero capacity requests no quota; a positive request requires actual quota enforcement by the selected adapter.
Types ¶
type Adapter ¶
type Adapter interface {
// Normalize validates and canonicalizes public parameters and encodes the
// credential input. Empty input encodes as an empty credential. A credential
// the parameters do not require, or a missing required one, is ErrInvalid.
// An encoded credential is valid input and encodes to itself, so Core can
// re-select a retained configuration with its stored credential.
Normalize(parameters, credential json.RawMessage) (json.RawMessage, []byte, error)
Control(ConfigurationRecord) (Control, error)
Resolver(Configuration) (Resolver, error)
}
Adapter registers one filesystem implementation. Its roles are separate and all mandatory. Normalize is a pure codec. Control is constructed only in Core from a retained record and its decrypted credential. Resolver is constructed from public configuration alone, so nodes never receive a credential. Construction performs no filesystem or network operation.
type Attachment ¶
type Attachment struct {
Reference Reference `json:"reference"`
ConfigurationID string `json:"configuration_id"`
Kind AttachmentKind `json:"kind"`
Native json.RawMessage `json:"native"`
}
Attachment is adapter-issued ownership evidence, not a public host path. The selected adapter must validate Native before using it.
func (Attachment) Validate ¶
func (a Attachment) Validate() error
type AttachmentKind ¶
type AttachmentKind string
const AttachmentHostDirectory AttachmentKind = "host_directory"
type Binding ¶
type Binding struct {
Configuration Configuration `json:"configuration"`
Attachment Attachment `json:"attachment"`
}
Binding transports the database-owned configuration transiently to a resolver; it must not become an independently authored node setting.
type Configuration ¶
type Configuration struct {
ID string `json:"id" format:"uuid" binding:"required"`
Adapter string `json:"adapter" binding:"required"`
Parameters json.RawMessage `json:"parameters" swaggertype:"object" binding:"required"`
}
Configuration is an immutable Core database record. Parameters belong to its adapter; neither Core nor the public Session API interprets native paths. Parameters are public: they reach nodes and administrator responses.
func (Configuration) Validate ¶
func (c Configuration) Validate() error
type ConfigurationRecord ¶
type ConfigurationRecord struct {
Configuration
Credential []byte `json:"-"`
}
ConfigurationRecord is a retained Configuration with its adapter-encoded private credential, empty when the parameters require none. Core encrypts Credential at rest, bound to its installation and Configuration.ID. It never enters a Binding, a response, an audit record or a log.
type Control ¶
type Control interface {
Declaration() Declaration
Check(context.Context) error
// Create retries and concurrent calls for the same immutable Reference converge
// on one object without overwriting its data, including after ErrUnconfirmed.
// A terminally deleted Reference must never be recreated. capacityMiB is the
// admitted bound Core persisted with the Reference and passes unchanged on
// every retry. Zero requests no quota. A positive value requires
// Declaration.CapacityQuota; the object's allocated bytes and inodes are then
// bounded by it before Create returns, and a retry verifies that bound.
Create(ctx context.Context, reference Reference, capacityMiB uint32) (Attachment, error)
// Delete retries and concurrent calls for the same Reference converge on
// terminal deletion. Concurrent or late Create cannot resurrect the object.
Delete(context.Context, Reference) error
}
Control is bound to one immutable Configuration. All operations are mandatory. Errors retain ownership; context cancellation does not prove mutation settlement. Delete requires explicit Session deletion and confirmed compute stop by Core.
type Declaration ¶
type Declaration struct {
Attachment AttachmentKind `json:"attachment" binding:"required"`
UserXAttr bool `json:"user_xattr" binding:"required"`
CapacityQuota bool `json:"capacity_quota" binding:"required"`
}
Declaration describes verified behavior. CapacityQuota means the adapter enforces every positive capacity passed to Create, not merely that it can report free space.
type Reference ¶
type Reference struct {
TenantID string `json:"tenant_id"`
EnvironmentID string `json:"environment_id"`
ObjectID string `json:"object_id"`
}
Reference is persisted before Create. Its canonical UUIDs are immutable and ObjectID is never reused, including after deletion or an unconfirmed mutation.
type Requirements ¶
type Requirements struct {
Attachment AttachmentKind `json:"attachment"`
UserXAttr bool `json:"user_xattr"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package nfs implements workspace storage on an operator-mounted kernel NFS filesystem.
|
Package nfs implements workspace storage on an operator-mounted kernel NFS filesystem. |
|
Package providers composes workspace filesystem adapters at process startup.
|
Package providers composes workspace filesystem adapters at process startup. |