mirror of
https://github.com/restic/rest-server.git
synced 2025-12-06 17:15:45 -08:00
Move maxsizewriter to quota package
This commit is contained in:
committed by
Alexander Neumann
parent
79a8785e26
commit
55e549e92c
19
handlers.go
19
handlers.go
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user