3.9 KiB
Architecture
Fork-only orientation for agents. The summary in AGENTS.md ("Architecture")
is upstream's and is not repeated here; this page adds what that summary
leaves out. Update in the same commit as any structural change.
Map
| Path | Responsibility |
|---|---|
rclone.go |
Entry point; blank-imports backend/all and cmd/all |
backend/<name>/ |
One storage backend per package, registered in init() |
cmd/<name>/ |
One cobra command per package |
fs/ |
Core interfaces, config, operations, sync, accounting |
vfs/ |
Virtual filesystem used by mount and serve |
lib/ |
Shared helpers: rest, pacer, dircache, oauthutil, encoder |
fstest/ |
Test framework: fstests (backend contract), test_all (runner) |
docs/content/ |
Hugo website source; partly autogenerated |
docs/specs/, docs/plans/ |
Fork-only agent workflow artefacts |
bin/ |
Build and docs scripts |
Test layers
- Unit tests:
RCLONE_CONFIG=/notfound go test ./...- no credentials. - Backend contract: each
backend/<name>/<name>_test.gocallsfstests.Run()against a remote namedTest<Name>:in the user's rclone config. Without that remote the test skips, so a greengo teston a backend package says nothing about the backend against the real service. - Integration:
fstest/test_allruns the backend contract plus thefs/operations,fs/sync,vfsetc. suites against the backends listed infstest/test_all/config.yaml.
Invariants
- Backwards compatibility of commands, flags, config keys and the rc API.
fsandvfscontain no backend-specific code.- cgo use differs per release target (the
cgoandbuild_flagscolumns of the matrix in.github/workflows/build.yml), so a backend cannot assume cgo.
backend/protondrive
A native client of the Proton Drive API, following Proton's Drive SDK
(spec: docs/specs/001-protondrive-tier1.md).
| File | Responsibility |
|---|---|
protondrive.go |
Fs, Object, options, Config sign-in, dircache glue, translateError |
session.go |
SRP and browser (session fork) sign-in, token refresh, app version |
account.go |
User and address keys, public-key lookups |
crypto.go |
Every OpenPGP operation |
nodes.go |
The client: volume bootstrap, pacing, listing, folder/rename/move/copy/trash |
cache.go |
In-memory node and listing cache |
upload.go, download.go |
Block pipelines; download.go also keeps the per-client cache of block sizes learnt for files that don't record them |
api/ |
Wire types |
protontest/ |
Fake Proton server, imported by tests only; never imports the backend |
-
The seam:
protondrive.goholds no cryptography and no API routes; the other files never take or returnfs.Fs/fs.Object. -
No package-level mutable state except
unlockMu(key unlocking is serialised acrossFsinstances). EachFshas its own client, session and cache; credentials go through a per-FsconfigStoreover the remote's config. -
fake_test.goruns the fullfstestscontract suite againstprotontestthrough the hiddenendpointoption, on everygo test;protondrive_test.gois the live suite (TestProtonDrive:). -
fstest/testserver/init.d/TestProtonDriveFakebuilds and startsprotontest/cmd/protonfakefortest_all, which runs the wider suites against theTestProtonDriveFake:remote. Fork CI is.gitea/workflows/ci.yml. -
User docs:
docs/content/protondrive.md(hand-written parts; the options section is generated from theHelp:fields).docs/specs/001-conformance-checklist.mdmaps each SDK module to its Go file and the tag it was last checked against. -
Not implemented yet: events and
ChangeNotify(M5); the persistent metadata cache, rclone Metadata and the small-file upload path (M6). Ranged reads check block hashes but not the signed manifest. Open items and unrun live checks are indocs/TODO.md.
Known rough edges
- See
docs/TODO.mdfor host tooling gaps.