syncfs

package
v0.0.0-...-0b698e0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0, MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Native sync filesystem adapter

ProbeNativeQuota reads existing native hard quota status for held selected and workspace-parent roots. On Linux it requires XFS project quota enforcement (accounting alone is refused), matching nonzero inherited project IDs, and a finite native hard limit. On macOS it matches the held APFS mount to the native volume record and requires a finite volume quota. Missing quotas return ErrQuotaUnsupported; incomplete native reports return ErrQuotaUnknown; changed held roots or mounts return ErrChanged. The probe never configures quotas or changes a host volume. Its typed evidence is a point-in-time native root-scope observation, not proof that every descendant or outside writer is covered, that a project/volume is exclusive to one operation, or that cleanup reclaimed storage. Public sync remains closed until Manager durably binds and revalidates an eligible complete scope on both endpoints and settlement is implemented.

Linux's Q_XGETQUOTA permission check requires CAP_SYS_ADMIN for a project quota; the self-query exception applies only to user and group quotas. An ordinary process receiving EPERM gets ErrQuotaUnknown and cannot use this probe to establish public sync authority. No privilege helper or provider setup path is implemented. See the kernel permission check.

SurveyWorkspace provides a bounded read-only st_blocks observation for one exact marked private workspace. It reopens the original reservation and roots, refuses child mounts and special files, checks symlink inodes without following their targets, and checks entry identities and block counts around traversal. It does not reserve space, cap writes, prove that cloned/shared blocks are exclusive, authorize cleanup, or release a disk lease. Concurrent same-account changes are not an atomic snapshot. Linux requires a reported STATX_MNT_ID. Darwin compares the descriptor-reported filesystem ID and nonempty mountpoint name, so equal filesystem IDs alone do not establish equal mounts. These are the strongest reported identities used here, not a cross-platform mount-ID equivalence; actual native mount-counterexample evidence is recorded per platform.

syncfs scans rooted filesystems and publishes actions from a reviewed syncreconcile.Plan. It is transport independent. The SSH worker must provide the authenticated account, root authorization, staged bytes, durable operation journal, resource admission, and endpoint completion receipts.

Caller sequence

  1. Open each selected root with OpenRoot. The path and every ancestor must be directories without symlinks. Keep the handles open through the operation.
  2. Open a private workspace parent outside the receiver root on the same filesystem. Probe the receiver name policy with DetectNamePolicy and scan both endpoints with the same metadata and exclusions. Supply peer, baseline, and resolution candidates so absent names receive native comparison keys.
  3. Use Root.NativeID for each endpoint's reviewed Binding.RootID. Reconcile, review the plan, and durably reserve the operation key, exact digest, generation, endpoint resources, and disk. Use CreateWorkspace for private sender and receiver trees. BuildSourceManifest copies only the actions supplied by one source side into an empty sender tree, mapping Action.SourcePath to Action.Path. SeedReceiverBasis copies reviewed receiver Before files into an empty receiver stage without hard links.
  4. Run rsync over the authenticated leased stream from each selected-only sender tree into the receiver stage. Apply all DirectoryMetadata records with FinalizeStageDirectories after transfers. Construct NewBoundPublisher with the same root, policy, metadata, exclusions, and a durable journal. Call ApplyAll once. Retain the workspace and receipts until both endpoints confirm the operation and a baseline can commit.

rsyncengine.Run transfers its entire supplied root. Passing a selected user root to it would send unreviewed paths; pass only a tree produced by BuildSourceManifest. Source and receiver roots must match their native plan IDs before staging and publication. Sender manifests, receiver basis copies, rsync temporary files, and retained preimages each consume disk at different points. StageCharge counts logical copied bytes and entries, while the Manager must reserve and observe actual physical overhead at both endpoints. The directory sidecar crosses the authenticated control channel and is checked against each reviewed After metadata hash before changing stage metadata. The worker still verifies all staged After fingerprints before publication.

Preflight verifies the whole staging tree against its logical byte budget, then verifies every staged After fingerprint before the first effect. Every effect rechecks the receiver's reviewed Before, root bindings, staging fingerprint, and private workspace bindings. Creates use exclusive rename; overwrites use atomic exchange and retain the displaced entry in quarantine; removals move the exact entry to quarantine. Directory metadata is finalized after child actions. A lost outcome acknowledgment leaves an unknown result; the caller must inspect retained evidence under the original key. Close only closes descriptors and does not delete evidence. CreateWorkspace can return a partially created workspace alongside an error. Inspect its held parent and native identities before interpreting the recorded path; a path replacement can make that name point elsewhere. Close returned handles after recording evidence, and never clean up by an unverified path string. For recovery inspection, InspectWorkspace reopens an exact recorded path against the original reservation and held roots. FindWorkspaces makes a bounded read-only search of the private parent when paths were not recorded; one operation can own several workspaces. FindWorkspace accepts only a single match. Malformed names in the reserved .arm-sync- namespace, absence, incomplete evidence, cancellation and search bounds remain unknown outcomes. Neither API authorizes deletion or release of the charged reservation. The search is not an atomic snapshot against concurrent same-account changes.

Supported subset and limits

  • Regular files, directories, and symlinks are fingerprinted without following symlinks. Special files, symlink metadata fidelity, directory type replacement, setuid/setgid/sticky modes, and non-ASCII names are rejected.
  • Files use SHA-256 content hashes. Optional permissions and whole-second modification times are included in metadata hashes. Directory contents are represented by separate child entries.
  • Scan bounds are 200,000 entries, 64 GiB per file, and 1 TiB of logical file bytes. The reservation bounds staged bytes plus retained non-directory preimages logically; it is not a physical filesystem quota or an endpoint resource reservation. The caller must charge actual overhead and maintain its own CPU, memory, disk, and operation limits.
  • Linux casefold directories are refused. Native Darwin and Linux rename primitives are implemented. All 29 current cases, including selected staging and native root identity, pass on macOS and actual Linux ARM64. macOS race/vet checks pass; Linux AMD64 remains compile-only evidence.

Named identity checks detect replacement at the observed native cuts. This is not isolation from a malicious process running as the same account, nor an atomic snapshot of a concurrently changing tree. Per-effect verification and retained unknown outcomes remain necessary. Private source and receiver stages must be disjoint from their selected roots in both directions; native ancestor identities are checked as well as paths. Root.NativeID v2 adds native creation evidence to path, device, inode, and filesystem identity. Darwin requires fstat birthtime and includes the reported generation, which can legitimately be zero. Linux requires a statx response with STATX_BTIME; mount ID is included when reported. Missing creation evidence returns ErrNativeIdentityUnavailable, never a zero-filled fallback. Persistent baseline reuse assumes the selected filesystem reports stable, sufficiently precise creation evidence; if that cannot be established, the worker must require fresh review/rebaseline after losing the held root. These IDs do not defend against deliberate filesystem manipulation by another process running as the same account.

This package does not initiate SSH, transfer chunks, persist a baseline, perform receipt lookup, replay uncertain effects, or clean up evidence.

Documentation

Overview

Package syncfs provides native, held-root observations and publication for reviewed sync actions. It does not grant authority, journal an operation, or confirm a reconciliation baseline.

Index

Constants

View Source
const EnrollmentOwnerLockName = ".arm-sync-owner.lock"
View Source
const EnrollmentRecordName = ".arm-sync-enrollment"

EnrollmentRecordName is stored under the held backing anchor, outside the selected project's home. Reading it is not native enrollment authority.

Variables

View Source
var ErrBackingHeadroom = errors.New("independent charged-sync backing headroom unavailable")
View Source
var ErrChanged = errors.New("sync filesystem binding or entry changed")
View Source
var ErrEnrollmentRecord = errors.New("charged sync enrollment record unavailable")
View Source
var ErrNativeIdentityUnavailable = errors.New("native root creation identity unavailable; re-review or rebaseline")

ErrNativeIdentityUnavailable means a persisted baseline cannot safely distinguish root inode reuse on this filesystem.

View Source
var ErrPreOpenEnrollment = errors.New("pre-open charged sync enrollment unavailable")
View Source
var ErrQuotaUnknown = errors.New("native sync quota status unknown")
View Source
var ErrQuotaUnsupported = errors.New("native sync quota unavailable")
View Source
var ErrUnknown = errors.New("sync native outcome unknown; retained evidence requires inspection")

Functions

func BuildSourceManifest

func BuildSourceManifest(ctx context.Context, source, manifest *Root, plan syncreconcile.Plan, sourceSide, receiverSide syncreconcile.Side, names NamePolicy, metadata Metadata, byteLimit int64) ([]DirectoryMetadata, StageCharge, error)

BuildSourceManifest copies only reviewed After sources for one source and receiver side into a fresh private tree. The tree can be passed as the entire sender root to rsyncengine.Run without exposing other source paths. The returned directory records must cross the authenticated control stream and be applied to the receiver stage after all transfer batches.

func FinalizeStageDirectories

func FinalizeStageDirectories(ctx context.Context, receiver, stage *Root, plan syncreconcile.Plan, receiverSide syncreconcile.Side, metadata Metadata, records []DirectoryMetadata) error

FinalizeStageDirectories restores reviewed directory modes and mtimes after all rsync batches. Records must cover exactly the receiver's directory After actions, regardless of which endpoint supplied their contents.

func VerifyPlanRoot

func VerifyPlanRoot(plan syncreconcile.Plan, side syncreconcile.Side, root *Root) error

VerifyPlanRoot refuses a stale or different native endpoint before any source materialization or receiver basis copy.

Types

type BackingHeadroom

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

BackingHeadroom is a descriptor-bound observation, not disk admission or proof that the recorded project is exclusively owned by this Manager.

func ProbeBackingHeadroom

func ProbeBackingHeadroom(ctx context.Context, backing, project *Root, enrollment *RecordedEnrollment) (BackingHeadroom, error)

ProbeBackingHeadroom reads the held parent of the dedicated project, not statfs(home), whose counters are limited by the project's remaining quota. The record is only an expected tuple; a future opener must separately prove native enrollment and ownership before using this observation for admission. The caller must keep both roots open, with no concurrent Root.Close, until this call has returned.

func (BackingHeadroom) AvailableBytes

func (b BackingHeadroom) AvailableBytes() int64

func (BackingHeadroom) BackingRootID

func (b BackingHeadroom) BackingRootID() string

func (BackingHeadroom) MountID

func (b BackingHeadroom) MountID() string

func (BackingHeadroom) TotalBytes

func (b BackingHeadroom) TotalBytes() int64

type CompleteScopeProof

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

CompleteScopeProof can only be built after an original owner exclusion and the complete platform verification. A copied or zero proof is refused when the owner fence is no longer live. BindingFor returns the cached observation; it does not freshly query quota or rescan the tree, and is not authority to execute work.

func VerifyCompleteScope

func VerifyCompleteScope(ctx context.Context, claim ScopeClaim, owner *ExclusiveScopeOwner, project, selected, parent *Root) (CompleteScopeProof, error)

VerifyCompleteScope reads an existing native limit and complete held trees. A diagnostic ProbeNativeQuota result or caller-supplied claim cannot mint a positive proof: the original exclusive owner must already be live. There is no production owner fence in this patch, so all current callers fail closed.

func (CompleteScopeProof) BindingFor

func (p CompleteScopeProof) BindingFor(ctx context.Context, claim ScopeClaim) (ScopeBinding, error)

func (CompleteScopeProof) VerificationToken

func (p CompleteScopeProof) VerificationToken() *syncscope.Verifier

VerificationToken is only an ordering witness for a subsequent fresh writer. It supplies no execution or quota authority by itself.

type DirectoryMetadata

type DirectoryMetadata struct {
	Path     string
	Mode     uint32
	MTimeSec int64
}

DirectoryMetadata is a plan-bound sidecar for restoring staged directory metadata after all rsync batches. Child transfer changes directory mtimes.

type EnrollmentRecord

type EnrollmentRecord struct {
	Version          string `json:"version"`
	Provider         string `json:"provider"`
	MountID          string `json:"mount_id"`
	ScopeID          string `json:"scope_id"`
	ProjectID        uint32 `json:"project_id"`
	ProjectRootID    string `json:"project_root_id"`
	SelectedRootID   string `json:"selected_root_id"`
	HomeRootID       string `json:"home_root_id"`
	BackingRootID    string `json:"backing_root_id"`
	OwnerUID         string `json:"owner_uid"`
	OwnerEpoch       uint64 `json:"owner_epoch"`
	ChargedHardBytes int64  `json:"charged_hard_bytes"`
}

EnrollmentRecord is a canonical, persisted intent for one dedicated XFS project. It cannot grant a scope: the native project, mount, quota and exclusive owner must still be checked before any Manager startup write.

func DecodeEnrollmentRecord

func DecodeEnrollmentRecord(raw []byte) (EnrollmentRecord, error)

DecodeEnrollmentRecord accepts only the one bounded canonical encoding. In particular, aliases, duplicate fields, trailing bytes and unknown fields cannot be normalized into a different ownership claim.

type ExclusiveScopeOwner

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

ExclusiveScopeOwner cannot be populated by a wire field or ordinary caller. Only an in-package provider with a real original-owner fence may construct it. This type alone is not Manager execution or cleanup authority.

func NewBoundOriginalScopeOwner

func NewBoundOriginalScopeOwner(ctx context.Context, claim ScopeClaim, original *syncscope.Original, project, selected, parent *Root) (*ExclusiveScopeOwner, error)

NewBoundOriginalScopeOwner joins a concrete live Manager original to the sealed native verifier. The shared Original keeps the sole SQLite connection and native mutation gate throughout VerifyCompleteScope. No caller-provided boolean or positive callback is accepted here.

type Journal

type Journal interface {
	Prepare(context.Context, Receipt) error
	Outcome(context.Context, Receipt) error
}

Journal must durably record Prepare before a native effect and Outcome after it. A failed Outcome leaves the same-key operation unknown; the caller must never infer success from a returned nil OS error alone.

type Metadata

type Metadata struct{ Permissions, ModTimes bool }

type NamePolicy

type NamePolicy struct{ CaseInsensitive bool }

func DetectNamePolicy

func DetectNamePolicy(selected, scratch *Root) (NamePolicy, error)

DetectNamePolicy probes an operation-owned private scratch directory on the selected root's filesystem. Linux per-directory casefold is refused during traversal; Unicode names are conservatively unsupported on both platforms.

func (NamePolicy) Key

func (p NamePolicy) Key(name string) (string, error)

type NativeQuotaEvidence

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

NativeQuotaEvidence reports a hard limit observed from the operating system for the original held roots. Only ProbeNativeQuota can construct a nonzero value. It does not establish exclusive operation ownership, a durable quota reservation, cleanup authority, or permission to open public sync dispatch.

func ProbeNativeQuota

func ProbeNativeQuota(ctx context.Context, selected, parent *Root) (NativeQuotaEvidence, error)

ProbeNativeQuota reads an existing native hard quota without configuring or changing the host. The zero evidence value always accompanies a refusal. Callers must re-probe at every later authority boundary and compare all identities; this point-in-time report is not a lock on quota configuration.

func (NativeQuotaEvidence) HardBytes

func (v NativeQuotaEvidence) HardBytes() uint64

func (NativeQuotaEvidence) Mount

func (v NativeQuotaEvidence) Mount() string

func (NativeQuotaEvidence) ParentRootID

func (v NativeQuotaEvidence) ParentRootID() string

func (NativeQuotaEvidence) Provider

func (v NativeQuotaEvidence) Provider() string

func (NativeQuotaEvidence) Scope

func (v NativeQuotaEvidence) Scope() string

func (NativeQuotaEvidence) SelectedRootID

func (v NativeQuotaEvidence) SelectedRootID() string

func (NativeQuotaEvidence) UsedBytes

func (v NativeQuotaEvidence) UsedBytes() uint64

type PreOpenEnrollmentCandidate

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

PreOpenEnrollmentCandidate holds a cooperating process owner and fresh native observations before Manager startup writes. It is not admission: complete mount-wide project assignment, writer fencing, schema binding and startup integration remain separate requirements. Close is not concurrent with Check; the caller must join all users before releasing the lock.

func OpenPreOpenEnrollmentCandidate

func OpenPreOpenEnrollmentCandidate(ctx context.Context, backingPath, projectPath, selectedPath, homePath string) (_ *PreOpenEnrollmentCandidate, err error)

OpenPreOpenEnrollmentCandidate never creates or repairs native state. The owner file must be provisioned outside the home before this call. Its nonblocking flock excludes cooperating openers and offline maintenance. A positive result cannot be passed to the ordinary Manager Open path. The returned candidate owns its roots; callers must not concurrently Close it or any borrowed root while a candidate method is running.

func (*PreOpenEnrollmentCandidate) Check

Check refreshes both native quota and independent backing observations while the same owner file remains held and named. It rechecks all four roots and the named record after the backing read. This is point-in-time evidence among cooperating owners, not a lock against an uncooperative writer or proof of all project-ID assignments on the mount; it grants no Manager write. The caller must join other candidate users before Close.

func (*PreOpenEnrollmentCandidate) Close

func (c *PreOpenEnrollmentCandidate) Close() error

func (*PreOpenEnrollmentCandidate) EnrollmentDigest

func (c *PreOpenEnrollmentCandidate) EnrollmentDigest() string

func (*PreOpenEnrollmentCandidate) Record

type Publisher

type Publisher struct {
	Root       *Root
	Work       *Workspace
	Plan       syncreconcile.Plan
	Metadata   Metadata
	Names      NamePolicy
	Exclusions []string
	Journal    Journal
	// contains filtered or unexported fields
}

func NewBoundPublisher

func NewBoundPublisher(root *Root, work *Workspace, plan syncreconcile.Plan, names NamePolicy, metadata Metadata, exclusions []string, journal Journal) (*Publisher, error)

NewBoundPublisher is the sync worker entry for publication. It verifies the receiver's held native root against the reviewed plan before constructing the lower-level publisher.

func NewPublisher

func NewPublisher(root *Root, work *Workspace, plan syncreconcile.Plan, names NamePolicy, metadata Metadata, exclusions []string, j Journal) (*Publisher, error)

func (*Publisher) ApplyAll

func (p *Publisher) ApplyAll(ctx context.Context) ([]Receipt, error)

ApplyAll is single-use. It verifies every staged After before any effect, then journals and applies exact actions in plan order. On the first fault it stops; returned receipts and retained stage/quarantine are recovery evidence.

type Receipt

type Receipt struct {
	Key, PlanDigest  string
	Generation       uint64
	Side             syncreconcile.Side
	Index            int
	Action           syncreconcile.Action
	State            string // prepared, applied, conflict, or unknown
	Preimage, Staged string
	Error            string
}

type RecordedEnrollment

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

RecordedEnrollment can only come from the held, exact named record read. A zero value or copied JSON fields cannot authorize the backing probe. It still does not establish native quota ownership or Manager admission.

func ReadEnrollmentRecord

func ReadEnrollmentRecord(backing *Root) (*RecordedEnrollment, error)

ReadEnrollmentRecord opens only the fixed no-follow file relative to the held backing anchor. It never creates or repairs enrollment. Its digest is an integrity comparison for a later native verifier, not bearer authority. The caller must keep backing open, with no concurrent Root.Close, until this call has returned.

func (*RecordedEnrollment) Digest

func (e *RecordedEnrollment) Digest() string

func (*RecordedEnrollment) Record

type Reservation

type Reservation struct {
	Key, PlanDigest string
	Generation      uint64
	Side            syncreconcile.Side
	DiskBytes       int64
}

Reservation is the caller's durable admission reference. syncfs verifies its shape and enforces DiskBytes during preflight, but only the controller can prove the reservation was actually charged to both endpoint budgets.

type Root

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

Root holds every named ancestor from / through the selected directory. Symlinks in that chain are refused. Operations use held descriptors and recheck the entire named binding before and after native cuts.

func OpenRoot

func OpenRoot(path string) (*Root, error)

func (*Root) Check

func (r *Root) Check() error

func (*Root) Close

func (r *Root) Close() error

func (*Root) FD

func (r *Root) FD() int

func (*Root) NativeID

func (r *Root) NativeID() (string, error)

NativeID binds a canonical named root to the held directory, filesystem, and supported native creation evidence. The caller must include effective account/enrollment in Endpoint.ID too. Earlier IDs intentionally do not match, so a baseline with weaker root identity cannot be reused silently.

func (*Root) Path

func (r *Root) Path() string

func (*Root) Scan

func (r *Root) Scan(ctx context.Context, candidates, exclusions []string, policy NamePolicy, metadata Metadata, limits ScanLimits) (syncreconcile.Snapshot, error)

Scan returns selected fingerprints and keys for all observed, candidate and excluded names. Candidate names include absent peer/baseline/resolution paths; exclusion ancestors are always keyed. It never follows symlinks.

type ScanLimits

type ScanLimits struct {
	Entries int
	Bytes   int64
}

type ScopeBinding

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

ScopeBinding is a copied native observation, not Manager execution authority. All fields are private; callers can only inspect its values.

func (ScopeBinding) HardBytes

func (b ScopeBinding) HardBytes() uint64

func (ScopeBinding) MountID

func (b ScopeBinding) MountID() string

func (ScopeBinding) OwnerEpoch

func (b ScopeBinding) OwnerEpoch() uint64

func (ScopeBinding) OwnershipDigest

func (b ScopeBinding) OwnershipDigest() string

func (ScopeBinding) ParentRootID

func (b ScopeBinding) ParentRootID() string

func (ScopeBinding) ProjectID

func (b ScopeBinding) ProjectID() uint32

func (ScopeBinding) ProjectRootID

func (b ScopeBinding) ProjectRootID() string

func (ScopeBinding) Provider

func (b ScopeBinding) Provider() string

func (ScopeBinding) ScopeID

func (b ScopeBinding) ScopeID() string

func (ScopeBinding) SelectedRootID

func (b ScopeBinding) SelectedRootID() string

func (ScopeBinding) UsedBytes

func (b ScopeBinding) UsedBytes() uint64

type ScopeClaim

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

ScopeClaim is a validated request to inspect one already-enforced native scope. It cannot authorize setup, execution, or native cleanup.

func NewScopeClaim

func NewScopeClaim(fields ScopeClaimFields) (ScopeClaim, error)

type ScopeClaimFields

type ScopeClaimFields struct {
	Key, Side, PreparationLease                 string
	Provider, ScopeID, MountID                  string
	ProjectRootID, SelectedRootID, ParentRootID string
	OwnershipDigest                             string
	ProjectID                                   uint32
	OwnerEpoch                                  uint64
	// ChargedHardBytes is the entire immutable native project hard ceiling
	// charged to the original Manager lease, not estimated free headroom.
	ChargedHardBytes int64
}

ScopeClaimFields are expected identities copied from a durable original preparation record. These caller values are requests, never proof.

type StageCharge

type StageCharge struct {
	Entries int
	Bytes   int64
}

StageCharge is a logical lower bound. The caller must reserve and observe actual filesystem allocation, temporary rsync files, metadata and journals.

func SeedReceiverBasis

func SeedReceiverBasis(ctx context.Context, receiver, stage *Root, plan syncreconcile.Plan, receiverSide syncreconcile.Side, names NamePolicy, metadata Metadata, byteLimit int64) (StageCharge, error)

SeedReceiverBasis copies each reviewed file Before into an empty private receiver stage. It never hard-links a live selected file; rsync may mutate these isolated basis copies while reconstructing the reviewed After.

type Workspace

type Workspace struct {
	Reservation                     Reservation
	Parent, Base, Stage, Quarantine *Root
	// contains filtered or unexported fields
}

Workspace is operation-owned staging and quarantine on the receiver's filesystem, outside selected contents. Close only closes handles: recovery evidence is retained until a separate confirmed cleanup procedure.

func CreateWorkspace

func CreateWorkspace(receiver, parent *Root, v Reservation) (*Workspace, error)

func FindWorkspace

func FindWorkspace(ctx context.Context, selected, parent *Root, want Reservation) (*Workspace, error)

FindWorkspace is the single-workspace form of FindWorkspaces. It refuses ambiguity; callers inspecting a multi-workspace operation should use the collection form and keep every charged obligation unresolved.

func FindWorkspaces

func FindWorkspaces(ctx context.Context, selected, parent *Root, want Reservation) (result []*Workspace, err error)

FindWorkspaces searches the held private parent for all marked workspaces with the original reservation. One operation can own more than one workspace. The result is read-only recovery evidence, not cleanup or release authority. Incomplete, absent or over-limit evidence leaves the outcome unknown.

func InspectWorkspace

func InspectWorkspace(selected, parent *Root, path string, want Reservation) (*Workspace, error)

InspectWorkspace reopens a named private workspace against the exact selected root, parent, and original reservation. It returns held handles for inspection only. A matching marker never authorizes deletion or proves physical reclamation; the caller must keep the charged lease unresolved.

func (*Workspace) Close

func (w *Workspace) Close() error

func (*Workspace) Path

func (w *Workspace) Path() string

func (*Workspace) QuarantinePath

func (w *Workspace) QuarantinePath() string

func (*Workspace) StagePath

func (w *Workspace) StagePath() string

type WorkspaceAllocation

type WorkspaceAllocation struct {
	Entries        int
	AllocatedBytes int64
}

WorkspaceAllocation is a bounded observation of st_blocks in one marked private workspace. Hard links, clones and shared filesystem blocks may be counted more than once; this is never exclusive reclamation evidence.

func SurveyWorkspace

func SurveyWorkspace(ctx context.Context, selected, parent *Root, path string, want Reservation) (WorkspaceAllocation, error)

SurveyWorkspace reads one exact marked workspace through held descriptors. It refuses changed entries and crossings of the reported native mount identity: Linux requires STATX_MNT_ID; Darwin pairs Fsid and Mntonname. This is not an atomic snapshot against same-account writers, proof of exclusive blocks, or cleanup authority.

Jump to

Keyboard shortcuts

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