syncworker

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

Fixed sync worker

syncworker runs a reserved syncservice intent on held syncfs roots over one authenticated SSH exec stream. The fixed command is arm sync-worker --protocol=1; no public CLI entry or unadmitted runner is exported. The destination must already have an exact, durably reserved intent in the same Manager transaction as its SSH admission. Both endpoints need a live Manager resource hold whose CheckIntent binds the exact SSH control, worker digest, account, key, roots, resources and lease. The hold must charge the actual selected filesystem for the worker lifetime; a resource promise in the intent is insufficient. Planning also needs a real charged hold before creating selected manifests and reviewing an intent; the worker cannot retroactively authorize uncharged planning.

The source sends a bounded preparation. Each endpoint reconstructs the plan from its own ledger and baseline, rechecks the held native root and selected manifest, and charges a conservative stage/basis/preimage/temporary-file forecast before creating a workspace. Only reviewed source actions enter each private rsync sender tree. Sequential protocol-27 batches share the admitted SSH channel with versioned control frames. The receiver verifies staged contents through syncfs before journaled native publication. Both exact side receipts are exchanged on the authenticated channel. Each endpoint closes and joins its transport before local baseline confirmation. A failed cut, channel, join or receipt leaves the original key for lookup; no worker replay is attempted.

Each receiver batch caps cumulative reconstructed regular-file writes at the sum of reviewed After file sizes for that source and receiver. The cap is snapshotted locally before the handshake. It includes basis bytes reconstructed into rsync temporary files. Receiver-basis preseed and source-manifest copies are separate operations covered by their existing forecasts and preflight limits, rather than this exchange counter. An overrun aborts the original transfer carrier and joins its protocol workers before native publication; ordinary successful batches keep the control carrier. This is a logical write guard; directories, symlinks, filesystem metadata, allocation granularity, snapshots, and other holders of the volume still require physical allocation enforcement and settlement.

The package remains an internal integration seam. Manager mints one-use source and destination holds; RunSource and RunDestination consume their exact roots, ledgers, contexts and original authenticated SSH channels. Source reservation precedes opening SSH. Its opener must provide the original CloseTransport and Join: channel close alone cannot establish inbound EOF. Cancellation closes that exact carrier, retires its original callback and joins transport workers before source completion. The destination decodes its pre-exec preparation under a separate charged owner and an exact one-session connection capability. No unrelated/shared connection closer can be supplied. The same conservative byte/structure allowance must fit final worker memory before preparation handoff; this is cooperative policy, not measured RSS or a kernel limit. Complete lease and volume-binding replacements refuse authority, and failures keep original charges for exact-key reconciliation.

The worker now records each marked receiver and source-manifest workspace in the endpoint's durable sync ledger before writing stage contents. A failed or uncertain workspace record stops that worker and retains native evidence and the resource promise. The bounded locator rows are read-only recovery inputs; they do not establish transport join, cleanup authority, exclusive block reclamation, or lease settlement. Public server dispatch, full physical allocation enforcement, cleanup settlement, multi-hop route integration and public sync controls remain required. Tests include independent durable ledgers, push/pull/both, additive/full, second-generation keep-both resolution, join failure, cancellation, and one authenticated sshservice.Server session. The original SSH protocol test uses a test admission hold. A separate real Manager pair test requires live host capacity and may skip; a skip does not prove complete private pair acceptance or cross-host/relay operation.

After workspace creation, basis and manifest copies, each completed rsync batch, and native publication, the worker surveys all of its marked workspaces. It stops when the sum of reported st_blocks exceeds the admitted disk promise or any survey is unknown. This detects overrun at those checkpoints and retains the charged workspaces for inspection. It does not prevent an in-flight write from exceeding the promise, prove that shared blocks are unique, or authorize cleanup. Public dispatch still requires an enforced allocation mechanism and exact settlement.

Allocation cuts retain the original endpoint, control session, plan and charged reservation identity. Each cut checks fresh execution authority, exact bounded operation and workspace rows, the complete original workspace set, and original held base/stage/quarantine roots before and after a fresh named survey. A valid replacement marker cannot replace an original held workspace. Unknown or cancelled observations retain physical obligations and already applied native effects; they do not create cleanup, release or public dispatch authority.

Documentation

Overview

Package syncworker contains the fixed, admitted sync execution state machine. The runner is exposed only through a concrete Manager-minted destination hold after exact admission; public server dispatch remains closed.

Index

Constants

Variables

This section is empty.

Functions

func FixedCommandSHA256

func FixedCommandSHA256() string

func RunDestination

func RunDestination(hold *manager.SyncWorkerHold) error

RunDestination executes the fixed worker on the exact in-process Manager hold minted after destination SSH and sync admission. The selected roots, ledger, resource promise and channel remain tied to that original hold. It consumes the one-shot launch; Wait/JoinTransport own actual completion.

func RunSource

func RunSource(hold *manager.SyncSourceHold) error

RunSource consumes the one-use source hold. The original authenticated SSH opener is bound at source admission; this entry point cannot substitute a channel or lifetime. The first frame precedes exec acknowledgement because destination admission reads it before accepting the fixed command.

Types

This section is empty.

Jump to

Keyboard shortcuts

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