Peering: outbound send pipeline with authorization and status (#103) #126
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/peering-send"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The sender half of #103: authorize, then move one file to a peer in the background, recording what happened. Builds on the
Clientfrom the previous commit.First change developed on a branch rather than on
main, per the working rule added afterci.ymlcaughtmaintransiently not compiling.Authorization, all synchronous before
StartreturnsThe caller gets a real error, not a job that fails a second later.
CanSend— §4.2's per-peering allow-list of users and IdP groups. Being logged in is not enough, and the globaluserSendEnabledtoggle the issue originally proposed is superseded.Writableis a hook, and nil means space content cannot be sent at all: failing closed beats guessing when the wiring is incomplete.Status store
Transfersis atomic JSON, the same pattern as the registry and share store — no database, per the standing rule.On open, anything still
pendingorstreamingbecomesfailedwith "interrupted by a restart; re-send to retry". v1 has no mid-flight resume, so a transfer that was in flight when the process died is not alive and must not look it.ForUserscopes the list to its owner: who sent what to whom is nobody else's business.One cost worth naming
The receiver is told the plaintext hash before any bytes move, so it has to be computed up front — which means reading the file twice, once to hash and once to stream. The alternative is sending no hash at all, which would leave integrity to the AEAD alone; that detects corruption in transit but cannot detect the sender encrypting the wrong file. The double read is the honest price of declaring integrity up front, and it is documented in the code rather than left as a surprise.
Not in this PR
The HTTP surface —
POST /api/v1/peering/sendandGET /api/v1/peering/transfers— and thecmd/cairndwiring that suppliesStat,Open,HeldandWritablefrom the real stores. The pipeline underneath them is complete and tested.10 tests,
gofmt,vet, full suite andgo build ./...all clean.