pub struct ObjectStorageTiering { /* private fields */ }Expand description
Production-quality hierarchical object storage tiering engine.
Maintains a set of TieredObject instances distributed across Hot, Warm,
and Cold tiers. Automatic promotion/demotion is driven by the
OstTierPolicy supplied in OstTierConfig.
Implementations§
Source§impl ObjectStorageTiering
impl ObjectStorageTiering
Sourcepub fn new(config: OstTierConfig) -> Self
pub fn new(config: OstTierConfig) -> Self
Create a new tiering engine with the supplied configuration.
Sourcepub fn store(
&mut self,
object: TieredObject,
) -> Result<OstStorageTier, TieringError>
pub fn store( &mut self, object: TieredObject, ) -> Result<OstStorageTier, TieringError>
Store an object, placing it in the most appropriate tier based on policy and available capacity.
New objects always attempt Hot first, then Warm, then Cold. The
current_tier field of the supplied object is ignored; the actual
assigned tier is returned.
Returns TieringError::TierFull if no tier can accept the object.
Sourcepub fn retrieve(
&mut self,
id: &str,
current_ts: u64,
) -> Result<&TieredObject, TieringError>
pub fn retrieve( &mut self, id: &str, current_ts: u64, ) -> Result<&TieredObject, TieringError>
Retrieve an object by ID, updating its last_accessed timestamp and
incrementing access_count. If the access count crosses the configured
promotion threshold the object is queued for promotion.
Returns TieringError::ObjectNotFound if the ID is unknown.
Sourcepub fn promote(
&mut self,
id: &str,
to: OstStorageTier,
current_ts: u64,
) -> Result<OstTierTransition, TieringError>
pub fn promote( &mut self, id: &str, to: OstStorageTier, current_ts: u64, ) -> Result<OstTierTransition, TieringError>
Promote an object to a hotter tier.
Returns TieringError::TierFull if the target tier lacks capacity.
Returns TieringError::ObjectNotFound if the ID is unknown.
Returns TieringError::PolicyConflict if to is colder than or equal
to the object’s current tier (use demote instead).
Sourcepub fn demote(
&mut self,
id: &str,
to: OstStorageTier,
current_ts: u64,
) -> Result<OstTierTransition, TieringError>
pub fn demote( &mut self, id: &str, to: OstStorageTier, current_ts: u64, ) -> Result<OstTierTransition, TieringError>
Demote an object to a colder tier.
Returns TieringError::TierFull if the target tier lacks capacity.
Returns TieringError::ObjectNotFound if the ID is unknown.
Returns TieringError::PolicyConflict if to is hotter than or equal
to the object’s current tier.
Sourcepub fn run_policy(&mut self, current_ts: u64) -> Vec<OstTierTransition>
pub fn run_policy(&mut self, current_ts: u64) -> Vec<OstTierTransition>
Evaluate all objects against the active policy and perform automatic promotions and demotions. Returns all transitions that occurred.
Policies applied:
AccessFrequency(n): objects withaccess_count > nnot in Hot → promote.RecencyBased(window_us): objects not accessed inwindow_usµs → Cold.SizeThreshold: enforce per-tier byte caps by demoting largest objects first.CostOptimized(multiplier): demote objects whose cost-adjusted score ranks them as low-value, keeping total cost under budget.ManualOnly: no automatic transitions.
Sourcepub fn evict_tier(
&mut self,
tier: OstStorageTier,
needed_bytes: u64,
) -> Vec<OstTierTransition>
pub fn evict_tier( &mut self, tier: OstStorageTier, needed_bytes: u64, ) -> Vec<OstTierTransition>
Demote objects from tier to make room for needed_bytes, using
Least-Recently-Used ordering. Returns all transitions performed.
Objects are demoted one tier at a time (Hot→Warm or Warm→Cold).
Sourcepub fn evict_tier_ts(
&mut self,
tier: OstStorageTier,
needed_bytes: u64,
current_ts: u64,
) -> Vec<OstTierTransition>
pub fn evict_tier_ts( &mut self, tier: OstStorageTier, needed_bytes: u64, current_ts: u64, ) -> Vec<OstTierTransition>
Like evict_tier but accepts an explicit timestamp.
Sourcepub fn tier_objects(&self, tier: OstStorageTier) -> Vec<&TieredObject>
pub fn tier_objects(&self, tier: OstStorageTier) -> Vec<&TieredObject>
Return references to all objects currently in tier.
Sourcepub fn transition_history(&self) -> Vec<OstTierTransition>
pub fn transition_history(&self) -> Vec<OstTierTransition>
Return a copy of the last up-to-500 tier transitions (oldest first).
Sourcepub fn stats(&self) -> TieringStats
pub fn stats(&self) -> TieringStats
Return aggregate statistics for all tiers.
Auto Trait Implementations§
impl Freeze for ObjectStorageTiering
impl RefUnwindSafe for ObjectStorageTiering
impl Send for ObjectStorageTiering
impl Sync for ObjectStorageTiering
impl Unpin for ObjectStorageTiering
impl UnsafeUnpin for ObjectStorageTiering
impl UnwindSafe for ObjectStorageTiering
Blanket Implementations§
impl<T> Allocation for T
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