From 1ebc912247cc104b674c277ea7f76c335d4bc72e Mon Sep 17 00:00:00 2001 From: Victor <87538976+visill@users.noreply.github.com> Date: Mon, 28 Oct 2024 23:43:56 +0500 Subject: [PATCH] Feature - deleting bloat files (#72) * Fixed the removal of bloat files after vacuum full * Fix import in test * simplifying logic (removed the ReworkFileName function) * remove ReworkFileName * Now it corresponds to the s3 interface. List path by prefix, not by folder --- pkg/storage/filestorage.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/storage/filestorage.go b/pkg/storage/filestorage.go index a05708f..8710d25 100644 --- a/pkg/storage/filestorage.go +++ b/pkg/storage/filestorage.go @@ -31,7 +31,7 @@ func (s *FileStorageInteractor) CatFileFromStorage(name string, offset int64, _ } func (s *FileStorageInteractor) ListPath(prefix string) ([]*object.ObjectInfo, error) { var data []*object.ObjectInfo - err := filepath.WalkDir(s.cnf.StoragePrefix+prefix, func(path string, d fs.DirEntry, err error) error { + err := filepath.WalkDir(s.cnf.StoragePrefix, func(path string, d fs.DirEntry, err error) error { if err != nil { return err } @@ -46,6 +46,12 @@ func (s *FileStorageInteractor) ListPath(prefix string) ([]*object.ObjectInfo, e if err != nil { return err } + + cuttedPrefix, _ := strings.CutPrefix(prefix, "/") + neededPrefix := s.cnf.StoragePrefix + cuttedPrefix + if !strings.HasPrefix(path, neededPrefix) { + return nil + } cPath, ok := strings.CutPrefix(path, s.cnf.StoragePrefix) if !ok { @@ -89,3 +95,11 @@ func (s *FileStorageInteractor) DeleteObject(key string) error { func (s *FileStorageInteractor) AbortMultipartUploads() error { return nil } + +func (s *FileStorageInteractor) AbortMultipartUpload(key, uploadId string) error { + return nil +} + +func (s *FileStorageInteractor) ListFailedMultipartUploads() (map[string]string, error) { + return nil, nil +}