Skip to content

Commit

Permalink
Feature - deleting bloat files (#72)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
visill authored Oct 28, 2024
1 parent d2b21fa commit 1ebc912
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/storage/filestorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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
}

0 comments on commit 1ebc912

Please sign in to comment.