pub struct CompactOptions {
pub max_live_ratio: f64,
pub max_pass_bytes: u64,
pub runtime: Option<HyperFileRuntimeConfig>,
pub relocate_chunk_bytes: usize,
pub dry_run: bool,
pub allow_consecutive: bool,
pub allow_foreign_keys: bool,
pub beside_writer: bool,
pub max_age: Duration,
}Expand description
Which objects compaction may rewrite, and how much it may do at once.
Fields§
§max_live_ratio: f64Rewrite an object only if at most this much of it is still live. At 1.0
every live object is a candidate, which rewrites the whole container.
max_pass_bytes: u64The most live bytes one pass rewrites. Objects are taken whole and cheapest first until the next would pass this; what is left waits for the next pass. Unlimited by default.
On a parted container with partial segments enabled — the default for
both — this is only a size: fs_relocate writes the pass out as partials
once it crosses the dirty-data limits, so memory is bounded by those
limits whatever the pass. Where no partial can be written, everything the
pass relocates stays dirty until its one flush, so the pass is also capped
at UNBOUNDED_PASS_BYTES; and a container that is not parted writes a
checkpoint as one object, so its pass is capped at what one object holds.
runtime: Option<HyperFileRuntimeConfig>The runtime configuration of the handle that does the rewrite: the size of
the partials a pass is written out as (data_cache_dirty_min_bytes_to_part
and the dirty-data limits), segment_buffer_size, the read cache,
multipart uploads. Give the one the container’s writer uses, and what a
compaction writes is shaped like what the writer writes.
None uses compaction_runtime_default. Either way the cleaner
overrides one field, flush_conflict_policy, to FailFast: a compactor
writes bytes it read earlier, and retrying on a conflict would republish
them over another writer’s newer ones.
relocate_chunk_bytes: usizeHow many bytes of blocks to hand fs_relocate at once. It holds what it
reads in a buffer of its own before the dirty cache takes it, so this bounds
that second copy.
dry_run: boolSelect and report, write nothing. No file is opened.
allow_consecutive: boolRun even though the newest checkpoint is already a compaction. The flag that
keeps content_cno still holds for one checkpoint only, so a second pass in
a row is seen by consumers as a change of content. Set this when that is
acceptable, for example to finish a container larger than one pass.
allow_foreign_keys: boolRun even though the prefix holds keys this crate does not recognize. Only set this having established that they are not a WAL.
beside_writer: boolCompact beside the container’s writer: attach the pass to the stored inode
rather than publish a checkpoint of its own (Hyper::fs_begin_compaction
and fs_publish_compaction in hyperfile). It keeps the checkpoint
number and the content checkpoint, and a writer of hyperfile 0.12 or later
takes it in before its next publish of data rather than failing as on a
second writer. Needs a container with parts (PartedSegment,
StreamSegment). allow_consecutive does not apply: an attached
compaction never moves content_cno.
The pass fails with ResourceBusy while a compaction is attached and not
yet taken in, or while the writer’s publish is on its way, and with
TimedOut past max_age; either way try again later.
max_age: DurationBeside the writer, the longest a pass may take from its start to its
attach; past it the pass is given up. Its copies are referenced by
nothing until attached, and only a prune grace keeps them, so set this
below the grace of any S3Cleaner::prune_with that may run meanwhile,
less a margin. Ten minutes by default.
Trait Implementations§
Source§impl Clone for CompactOptions
impl Clone for CompactOptions
Source§impl Debug for CompactOptions
impl Debug for CompactOptions
Auto Trait Implementations§
impl Freeze for CompactOptions
impl RefUnwindSafe for CompactOptions
impl Send for CompactOptions
impl Sync for CompactOptions
impl Unpin for CompactOptions
impl UnsafeUnpin for CompactOptions
impl UnwindSafe for CompactOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more