exlab_wizard.sync.transports.rclone#
rclone transport driver. Backend Spec §7.1.3.
Single transport binary for the NAS sync subsystem. Push uses
rclone copy --checksum --files-from; verify uses rclone check
--download --combined which streams remote bytes back and computes
SHA-256 locally (the only way to integrity-check SFTP and SMB backends,
which expose no server-side hashing).
The driver is intentionally thin: it builds an argv, hands it to
exlab_wizard.sync.transports._run.run_subprocess(), and
translates the exit-code + stderr-substring into one of the
TransportErrorKind retry classes.
rclone.conf NAS-sync migration: the connection (host, credentials,
backend type) is defined entirely by a named remote in the operator’s
rclone.conf. The driver injects no credentials and never sees a
password – it only passes --config <path> when the nas: block
pins one.
Classes
|
Outcome of |
|
Parsed result of a |
|
rclone transport driver. |
- class exlab_wizard.sync.transports.rclone.AboutResult(ok, reason=None, info=<factory>)[source]#
Bases:
objectOutcome of
rclone about <remote> --json.Surfaces as the equipment-probe response.
okflips true when rclone returned 0;reasoncarries the classified failure mode otherwise.infoholds the parsed JSON payload on success (free-space, used, etc.) so the Settings panel can render it.
- class exlab_wizard.sync.transports.rclone.CheckResult(equal=(), differ=(), extra_on_dst=(), missing_on_dst=(), errors=())[source]#
Bases:
objectParsed result of a
rclone check --combinedrun.The combined-output format emits one prefixed line per file:
= path– present and identical on both sides* path– present on both sides but differs+ path– present on the destination only- path– missing on the destination! path– error encountered checking this path
Each field below carries the run-relative POSIX paths corresponding to its prefix.
- Parameters:
- class exlab_wizard.sync.transports.rclone.RcloneDriver(*, binary='rclone', config_path=None, transfers=None, checkers=None)[source]#
Bases:
objectrclone transport driver. Backend Spec §7.1.3.
- async about(remote)[source]#
Run
rclone about <remote> --json– the equipment probe.Used by the Settings “Test connection” affordance. Confirms authentication and reachability; surfaces parsed free-space info on success. Failure paths are translated into
AboutResultrather than raised, so the UI panel can render the reason inline.- Parameters:
remote (
str)- Return type:
- async check(local, remote, *, files_from)[source]#
Run
rclone check --download --files-from --combinedoverfiles_from.Streams the remote files back to compute their SHA-256 locally (the only way to integrity-check SFTP and SMB backends, which expose no server-side hashing).
--combinedwrites one= / * / + / - / !line per file to a tempfile that this method parses and returns as aCheckResult.Raises
TransportErrorwith a classifiederror_kindwhen rclone itself failed (auth / network / unknown) – a clean run with files in thedifferormissing_on_dstcolumns returnsok=Trueso the caller can route partial-failure reconciliation correctly.- Parameters:
- Return type:
- async listremotes()[source]#
Return the remote names defined in rclone.conf (each incl. trailing
:)Offline and cheap — no network. Used by the setup-availability gate and the Settings remote badge. A missing/unreadable config yields
()so callers treat “no remotes” the same as “remote not found”.
- async lsjson(remote, *, recursive=True)[source]#
Run
rclone lsjson(read-only) and return the raw JSON array text.Listing only — no transfer, no remote mutation.
recursiveadds-Rso a whole run subtree returns in one call. RaisesTransportErrorwith a classifiederror_kindon a non-zero exit so callers route auth/network failures the same way as push/check.
- async push(local, remote, *, bwlimit_kibps=None, files_from=None)[source]#
Run
rclone copy --checksumfromlocaltoremote.remoteis the full<remote_name>:<path>string; the named remote (and its credentials) lives in the operator’srclone.conf.bwlimit_kibpsis forwarded as--bwlimit <K>Kwhen set;files_fromis forwarded as--files-from <path>so only a subset of the local tree transfers.Returns a
TransportResult. A spawn failure raisesTransportErrorso the queue terminates rather than looping on a missing binary.