internal/fetch: remove ZipSize from getters
A ModuleGetter no longer needs the ZipSize method, because
load-shedding has been moved into the worker, where it uses the proxy
client directly.
For golang/go#48010
Change-Id: I01eb0b88ac758e83be20333b73b4315985fc9d8e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/346751
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/internal/fetch/getters.go b/internal/fetch/getters.go
index 4a78b25..2d76deb 100644
--- a/internal/fetch/getters.go
+++ b/internal/fetch/getters.go
@@ -41,10 +41,6 @@
// to have according to the zip archive layout specification at
// https://golang.org/ref/mod#zip-files.
ContentDir(ctx context.Context, path, version string) (fs.FS, error)
-
- // ZipSize returns the approximate size of the zip file in bytes.
- // It is used only for load-shedding.
- ZipSize(ctx context.Context, path, version string) (int64, error)
}
type proxyModuleGetter struct {
@@ -75,12 +71,6 @@
return fs.Sub(zr, path+"@"+version)
}
-// ZipSize returns the approximate size of the zip file in bytes.
-// It is used only for load-shedding.
-func (g *proxyModuleGetter) ZipSize(ctx context.Context, path, version string) (int64, error) {
- return g.prox.ZipSize(ctx, path, version)
-}
-
// Version and commit time are pre specified when fetching a local module, as these
// fields are normally obtained from a proxy.
var (
@@ -153,11 +143,6 @@
return os.DirFS(g.dir), nil
}
-// ZipSize returns the approximate size of the zip file in bytes.
-func (g *directoryModuleGetter) ZipSize(ctx context.Context, path, version string) (int64, error) {
- return 0, errors.New("directoryModuleGetter.ZipSize unimplemented")
-}
-
// An fsProxyModuleGetter gets modules from a directory in the filesystem
// that is organized like the proxy, with paths that correspond to proxy
// URLs. An example of such a directory is $(go env GOMODCACHE)/cache/download.
@@ -240,11 +225,6 @@
return fs.Sub(zr, path+"@"+vers)
}
-// ZipSize returns the approximate size of the zip file in bytes.
-func (g *fsProxyModuleGetter) ZipSize(ctx context.Context, path, version string) (int64, error) {
- return 0, errors.New("fsProxyModuleGetter.ZipSize unimplemented")
-}
-
// latestVersion gets the latest version that is in the directory.
func (g *fsProxyModuleGetter) latestVersion(modulePath string) (_ string, err error) {
defer derrors.Wrap(&err, "fsProxyModuleGetter.latestVersion(%q)", modulePath)