pub struct TieringEngine { /* private fields */ }Expand description
Cold-storage archiver: uploads encoded archive objects and verifies them.
Candidate selection, encoding, catalog removal and local deletion belong to the database, which is the only thing that can order them safely.
Implementations§
Source§impl TieringEngine
impl TieringEngine
Sourcepub const fn new(config: TieringConfig, remote: ObjectStoreBackend) -> Self
pub const fn new(config: TieringConfig, remote: ObjectStoreBackend) -> Self
Create a new archiver over remote.
Sourcepub const fn config(&self) -> &TieringConfig
pub const fn config(&self) -> &TieringConfig
Returns the tiering configuration.
Sourcepub fn is_eligible(&self, max_timestamp_ns: i64, now_ns: i64) -> bool
pub fn is_eligible(&self, max_timestamp_ns: i64, now_ns: i64) -> bool
Check if a segment is eligible for cold tiering.
A segment is eligible if its max_timestamp is older than
now - cold_after, where both values are in nanoseconds since
epoch (matching segment header timestamp units).
Sourcepub async fn upload_archive(
&self,
object: &ArchiveObject,
data: &[u8],
) -> Result<String>
pub async fn upload_archive( &self, object: &ArchiveObject, data: &[u8], ) -> Result<String>
Upload one encoded archive object and verify it landed intact.
Returns the object key. The caller’s next step is to drop the source segments, so an upload that cannot be verified is an error rather than a warning: the old engine logged and returned success, and a caller that removed the catalog entry on a successful return then dropped data that was never archived.
§Errors
Returns an error if the upload fails, or if the object is absent or of the wrong size afterwards.
Auto Trait Implementations§
impl !Freeze for TieringEngine
impl !RefUnwindSafe for TieringEngine
impl !UnwindSafe for TieringEngine
impl Send for TieringEngine
impl Sync for TieringEngine
impl Unpin for TieringEngine
impl UnsafeUnpin for TieringEngine
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