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
impl S3Cleaner
Sourcepub async fn report(&self, low: Cno, high: Cno) -> Result<Report>
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.
Sourcepub async fn compact(
&self,
low: Cno,
high: Cno,
opts: &CompactOptions,
) -> Result<CompactOutcome>
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
impl S3Cleaner
Sourcepub async fn new(root_uri: &str) -> Result<Self>
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.
Sourcepub async fn with_client(client: &Client, root_uri: &str) -> Result<Self>
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
impl Cleaner for S3Cleaner
Source§async fn prune(&self, low: Cno, high: Cno) -> Result<()>
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>)>
async fn collect( &self, low: Cno, high: Cno, ) -> Result<(Vec<SegmentId>, Vec<SegmentId>)>
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for S3Cleaner
impl !UnwindSafe for S3Cleaner
impl Freeze for S3Cleaner
impl Send for S3Cleaner
impl Sync for S3Cleaner
impl Unpin for S3Cleaner
impl UnsafeUnpin for S3Cleaner
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> 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