Move package-type-specific local repo logic into provider packages via
optional interfaces, eliminating switch statements from handlers.
- provider.LocalUploader: ValidateUpload + UploadResponse
- provider.LocalIndexer: ServeLocalIndex + GenerateLocalIndex
- provider.FileStore: interface for querying local files (implemented
by database.DB)
PyPI and Terraform providers now implement both interfaces. The local
handler and v1 proxy use type assertions to dispatch — adding a new
local repo type only requires implementing the interfaces in its
provider package, no handler changes needed.
local.go: 468 → 163 lines (removed all PyPI/Terraform specifics)
proxy.go: 211 → 136 lines (removed switch + helper methods)
engine.go: removed LocalIndexGenerator, uses provider.LocalIndexer
## Summary
- Virtual engine detects local members and generates indexes in-memory
- MemberIndex.RepoType drives correct URL prefix in merged output
- PyPI merger rewrites links to /api/v1/local/ or /api/v1/remote/ appropriately
- Includes local PyPI support (cherry-picked from #50)
## Test plan
- [x] Upload wheel to local PyPI → install from direct local URL
- [x] Create virtual with local + remote → install from virtual URL
- [x] Both paths produce correct absolute download URLs
Reviewed-on: #51
Co-authored-by: Ben Vincent <ben@unkin.net>
Co-committed-by: Ben Vincent <ben@unkin.net>