Peering: end-user send API and cairnd wiring — closes #103 #127
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/peering-send-api"
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 last piece of #103. Peering is now reachable end to end: an authorized user can send a file to a registered peer and watch it complete.
Deliberately not admin-gated. Who may send is a per-peering decision (§4.2), not a function of operator status — an admin with no allow-list entry cannot send, and a non-admin with one can.
Two things worth calling out
GET /peering/peersreturns a projection, never the storedPeer. That struct carries the peering key, which is a credential. Returning it directly would leak it to every authenticated user. There is a test assertingCAIRN-PEER1never appears in the response, and that a peer the caller may not use is absent entirely — the dropdown #105 renders should only offer what will actually work.Legal holds check both accessors.
holdStore.Held(p) || holdStore.Affected(p), because your requirement is that a file inside a held folder is also blocked, and the two accessors' exact semantics aren't documented. Over-blocking a send is a recoverable annoyance; under-blocking defeats the hold entirely.Space write-membership needs no new API
§4.2 requires write membership to send space content. A read-only member belongs to the read-only variant group, never to
<space>itself — so plain group membership is the write test. No spaces-manager call, no extra round trip, and it works in every auth mode.Wiring
Stat/Opengo through the caller's scoped, decorated store, so read authorization and decryption happen with their keys — sending is a read like any other. The background job usescontext.WithoutCancel, which keeps the user in context after the HTTP request returns.New config:
peering.transfersPath, defaulting to/data/.cairn/peer-transfers.json.7 API tests,
gofmt,vet, full suite andgo build ./...all clean. Developed on a branch;mainnever went red.Still open on the peering track
#105 (UI — needs your interaction design) and #106 (dogfood — needs the out-of-band key exchange only you can do). Also worth a
v0.4.2tag now that a transfer can complete end to end.