You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1013 B

  1. package storage
  2. import (
  3. "fmt"
  4. "github.com/chrislusf/seaweedfs/weed/glog"
  5. )
  6. func (s *Store) CheckCompactVolume(volumeId VolumeId) (float64, error) {
  7. if v := s.findVolume(volumeId); v != nil {
  8. glog.V(3).Infof("volumd %d garbage level: %f", volumeId, v.garbageLevel())
  9. return v.garbageLevel(), nil
  10. }
  11. return 0, fmt.Errorf("volume id %d is not found during check compact", volumeId)
  12. }
  13. func (s *Store) CompactVolume(vid VolumeId, preallocate int64) error {
  14. if v := s.findVolume(vid); v != nil {
  15. return v.Compact(preallocate)
  16. }
  17. return fmt.Errorf("volume id %d is not found during compact", vid)
  18. }
  19. func (s *Store) CommitCompactVolume(vid VolumeId) error {
  20. if v := s.findVolume(vid); v != nil {
  21. return v.commitCompact()
  22. }
  23. return fmt.Errorf("volume id %d is not found during commit compact", vid)
  24. }
  25. func (s *Store) CommitCleanupVolume(vid VolumeId) error {
  26. if v := s.findVolume(vid); v != nil {
  27. return v.cleanupCompact()
  28. }
  29. return fmt.Errorf("volume id %d is not found during cleaning up", vid)
  30. }