Move maxsizewriter to quota package

This commit is contained in:
Konrad Wojas 2020-05-03 20:37:01 +08:00 committed by Alexander Neumann
parent 79a8785e26
commit 55e549e92c
2 changed files with 64 additions and 44 deletions

View file

@ -34,9 +34,6 @@ type Server struct {
PrivateRepos bool
Prometheus bool
Debug bool
MaxRepoSize int64
repoSize int64 // must be accessed using sync/atomic
}
func (s *Server) isHashed(dir string) bool {
@ -487,22 +484,6 @@ func (s *Server) GetBlob(w http.ResponseWriter, r *http.Request) {
}
}
// tallySize counts the size of the contents of path.
func tallySize(path string) (int64, error) {
if path == "" {
path = "."
}
var size int64
err := filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
size += info.Size()
return nil
})
return size, err
}
// SaveBlob saves a blob to the repository.
func (s *Server) SaveBlob(w http.ResponseWriter, r *http.Request) {
if s.Debug {