Phase 2b (0.6.1-beta): dual-write file_holders on all propagation events

Populate the flat holder set alongside every existing post_upstream /
post_downstream / blob_upstream / blob_downstream write so that read
paths can be switched over in the next commit without losing continuity.

Events wired:
- Pull sync receive (3 paths in connection.rs)
- PostPush receive (public posts only after Phase 1)
- PostFetch via notification (discovery pull)
- PostDownstreamRegister
- Replication accept (downstream) + replication-driven pull (upstream)
- Attachment upstream recorded after replication blob fetch
- ManifestPush receive (remote is a CID holder)
- ManifestPush send (downstream peer becomes CID holder)
- Blob fetch fallback (upstream lateral sources)

Direction is tracked as Received vs Sent. Not load-bearing for routing;
retained for future use. LRU cap of 5 enforced on every touch.

Legacy upstream/downstream writes remain in place; they'll go away
together with the table drops at the end of this phase.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Scott Reimers 2026-04-21 20:56:28 -04:00
parent 1658762a68
commit 0b2b4f5a68
3 changed files with 88 additions and 1 deletions

View file

@ -1032,9 +1032,17 @@ impl Network {
}],
};
let mut sent = 0;
for (ds_nid, _) in &downstream {
for (ds_nid, ds_addrs) in &downstream {
if self.send_to_peer_uni(ds_nid, MessageType::ManifestPush, &payload).await.is_ok() {
sent += 1;
// We pushed this file's manifest → downstream peer now holds it.
let storage = self.storage.get().await;
let _ = storage.touch_file_holder(
cid,
ds_nid,
ds_addrs,
crate::storage::HolderDirection::Sent,
);
}
}
sent