pub trait Cleaner {
// Required methods
fn collect(
&self,
low: Cno,
high: Cno,
) -> impl Future<Output = Result<(Vec<SegmentId>, Vec<SegmentId>)>> + Send;
fn prune(
&self,
low: Cno,
high: Cno,
) -> impl Future<Output = Result<()>> + Send;
}Expand description
Operations supported by a hyperfile cleaner backend.
Both methods take a [low, high] range of checkpoint numbers
(Cno). high == 0 is a sentinel meaning “use the latest published
checkpoint (Inode::get_last_cno)”. low is inclusive; a typical value
is 1 to cover the entire file history.
The range is inclusive at both ends, so low == high is valid and
answered normally — which is what collect(1, 0) resolves to on a file with
a single checkpoint. Only low > high is an error, and that also covers a
file that has never been flushed (get_last_cno() == 0), since there is no
metadata tree to walk.
What the methods report and delete is SegmentId, which names a stored
object rather than a checkpoint: a checkpoint written under
BlockPtrFormat::PartedSegment is several objects — <cno>.0, <cno>.1, …
— and they are not reclaimable together. Under every other format an object
and a checkpoint are the same thing and a SegmentId prints as the plain
number.
Required Methods§
Sourcefn collect(
&self,
low: Cno,
high: Cno,
) -> impl Future<Output = Result<(Vec<SegmentId>, Vec<SegmentId>)>> + Send
fn collect( &self, low: Cno, high: Cno, ) -> impl Future<Output = Result<(Vec<SegmentId>, Vec<SegmentId>)>> + Send
Walk the metadata tree of the checkpoint identified by high
(or the latest if high == 0) and return
(referenced, unreferenced) lists of segment objects, the
unreferenced one limited to checkpoints within [low, high].
Useful for dry-run inspection before invoking Cleaner::prune.
Sourcefn prune(&self, low: Cno, high: Cno) -> impl Future<Output = Result<()>> + Send
fn prune(&self, low: Cno, high: Cno) -> impl Future<Output = Result<()>> + Send
Walk the metadata tree as in Cleaner::collect and then
delete the unreferenced segment objects from the underlying
store.
Errors if any individual delete batch fails; in that case previously-deleted batches stay deleted (S3 has no transactional batch). The returned error message mentions the failed object count and a sample failed key.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".