mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 07:33:21 +00:00
Move maxsizewriter to quota package
This commit is contained in:
parent
79a8785e26
commit
55e549e92c
2 changed files with 64 additions and 44 deletions
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue