Skip to main content

CompactOptions

Struct CompactOptions 

Source
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: f64

Rewrite 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: u64

The 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: usize

How 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: bool

Select and report, write nothing. No file is opened.

§allow_consecutive: bool

Run 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: bool

Run even though the prefix holds keys this crate does not recognize. Only set this having established that they are not a WAL.

§beside_writer: bool

Compact 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: Duration

Beside 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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CompactOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CompactOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scope for T

Source§

fn with<F, R>(self, f: F) -> R
where Self: Sized, F: FnOnce(Self) -> R,

Scoped with ownership.
Source§

fn with_ref<F, R>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Scoped with reference.
Source§

fn with_mut<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Scoped with mutable reference.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> Value for T
where T: Send + Sync + 'static,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more