Browse Source

fix destroy to use VolumeError::NotEmpty instead of generic Io error

The dedicated NotEmpty variant exists in the enum but was not being
used. This makes error matching consistent with Go's ErrVolumeNotEmpty.
rust-volume-server
Chris Lu 7 days ago
parent
commit
7f470a9928
  1. 5
      seaweed-volume/src/storage/volume.rs

5
seaweed-volume/src/storage/volume.rs

@ -2979,10 +2979,7 @@ impl Volume {
/// Remove all volume files from disk.
pub fn destroy(&mut self, only_empty: bool) -> Result<(), VolumeError> {
if only_empty && self.file_count() > 0 {
return Err(VolumeError::Io(io::Error::new(
io::ErrorKind::Other,
"volume not empty".to_string(),
)));
return Err(VolumeError::NotEmpty);
}
if self.is_compacting {
return Err(VolumeError::Io(io::Error::new(

Loading…
Cancel
Save