Skip to main content

S3Cleaner

Struct S3Cleaner 

Source
pub struct S3Cleaner { /* private fields */ }
Expand description

S3-backed cleaner for a single hyperfile rooted at a given s3://<bucket>/<prefix> URI.

The cleaner does not retain or open the file’s data. It only reads the published inode and walks the metadata B+tree to enumerate referenced segments, then deletes the unreferenced ones via DeleteObjects.

Concurrency: the cleaner is not aware of in-flight writers. If a writer publishes a new checkpoint while collect / prune is running, the result reflects whatever inode was loaded at the start of the call. New segments published after that point are outside the configured [low, high] range and are not affected.

Implementations§

Source§

impl S3Cleaner

Source

pub async fn report(&self, low: Cno, high: Cno) -> Result<Report>

What the container’s storage is made of: per-object liveness for every object whose checkpoint falls in [low, high].

Read-only, and the same walk collect does plus one ListObjectsV2 for sizes. high == 0 means the latest published checkpoint.

Source

pub async fn compact( &self, low: Cno, high: Cno, opts: &CompactOptions, ) -> Result<CompactOutcome>

Rewrite the live blocks of mostly-dead objects so prune can reclaim them.

The caller must be the container’s only writer for the duration; see the module docs for why that is not a nicety. Nothing is deleted here — a compaction makes objects reclaimable and prune reclaims them, which keeps the destructive step in one place.

Source§

impl S3Cleaner

Source

pub async fn new(root_uri: &str) -> Result<Self>

Construct a cleaner for root_uri, using the AWS SDK’s default credential / region resolution (aws_config::load_from_env).

Returns InvalidInput if root_uri is not a valid S3 URI.

Source

pub async fn with_client(client: &Client, root_uri: &str) -> Result<Self>

Construct a cleaner using a caller-supplied Client. Use this when you need to control region / endpoint / credential resolution explicitly (for example, in tests or in a tool that already has a configured client).

Returns InvalidInput if root_uri is not a valid S3 URI.

Trait Implementations§

Source§

impl Cleaner for S3Cleaner

Source§

async fn prune(&self, low: Cno, high: Cno) -> Result<()>

Prune unreferenced segment objects in [low, high]. Implemented as collect followed by DeleteObjects of the unreferenced list.

Source§

async fn collect( &self, low: Cno, high: Cno, ) -> Result<(Vec<SegmentId>, Vec<SegmentId>)>

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]. 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> 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, 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