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
Trust: Jonathan Amsterdam
Run-TryBot: Jonathan Amsterdam
@@ -41,10 +41,6 @@ type ModuleGetter interface {
// 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 @@ func (g *proxyModuleGetter) ContentDir(ctx context.Context, path, version string
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 @@ func (g *directoryModuleGetter) ContentDir(ctx context.Context, path, version st
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 @@ func (g *fsProxyModuleGetter) ContentDir(ctx context.Context, path, vers string)
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)
