-
-
Notifications
You must be signed in to change notification settings - Fork 1
Support mirroring from another proxy instance (peer caching) #41
Description
A proxy instance should be able to use another proxy instance as a cache peer, fetching artifacts (and potentially metadata) from it before going to the real upstream registry.
The storage interface already uses deterministic paths (ecosystem/name/version/filename for artifacts, _metadata/ecosystem/name/metadata.json for metadata). Two proxy instances using the same path scheme can address each other's cached blobs directly.
A central proxy with a large cache (pre-warmed via mirror jobs) would expose a simple API:
GET /api/cache/{path...}- serve a blob by storage pathHEAD /api/cache/{path...}- check existence
Satellite proxies would configure the central instance as a peer. On cache miss, the satellite checks the peer before falling back to the public registry. Artifacts pulled from a peer get cached locally so subsequent requests are fast.
This could be implemented as a Storage wrapper that chains local storage with one or more remote peers, keeping the handler layer completely unaware of peering. The SHA256 hashes already stored with each artifact provide integrity verification on peer transfers.
Useful for multi-office setups, CI fleets, and air-gapped environments where a DMZ proxy is the only thing with internet access.