pub struct LifecyclePolicyManager { /* private fields */ }Expand description
Lifecycle policy manager
Implementations§
Source§impl LifecyclePolicyManager
impl LifecyclePolicyManager
Sourcepub fn new(config: LifecyclePolicyConfig) -> Self
pub fn new(config: LifecyclePolicyConfig) -> Self
Create a new lifecycle policy manager
Sourcepub fn add_rule(&self, rule: LifecycleRule)
pub fn add_rule(&self, rule: LifecycleRule)
Add a lifecycle rule
Sourcepub fn remove_rule(&self, rule_id: &str) -> bool
pub fn remove_rule(&self, rule_id: &str) -> bool
Remove a lifecycle rule
Sourcepub fn get_rules(&self) -> Vec<LifecycleRule>
pub fn get_rules(&self) -> Vec<LifecycleRule>
Get all rules
Sourcepub fn register_block(&self, metadata: BlockMetadata)
pub fn register_block(&self, metadata: BlockMetadata)
Register block metadata
Sourcepub fn record_access(&self, cid: &Cid)
pub fn record_access(&self, cid: &Cid)
Update block access
Sourcepub fn evaluate(&self) -> Vec<LifecycleActionResult>
pub fn evaluate(&self) -> Vec<LifecycleActionResult>
Evaluate policies and return actions to take
Sourcepub async fn apply_actions<S: BlockStore>(
&self,
store: &S,
actions: Vec<LifecycleActionResult>,
) -> Vec<LifecycleActionResult>
pub async fn apply_actions<S: BlockStore>( &self, store: &S, actions: Vec<LifecycleActionResult>, ) -> Vec<LifecycleActionResult>
Apply lifecycle actions to a block store
Sourcepub fn get_stats(&self) -> LifecycleStatsSnapshot
pub fn get_stats(&self) -> LifecycleStatsSnapshot
Get lifecycle statistics
Sourcepub fn get_blocks_by_tier(&self, tier: StorageTier) -> Vec<Cid> ⓘ
pub fn get_blocks_by_tier(&self, tier: StorageTier) -> Vec<Cid> ⓘ
Get blocks by tier
Auto Trait Implementations§
impl !Freeze for LifecyclePolicyManager
impl !RefUnwindSafe for LifecyclePolicyManager
impl Send for LifecyclePolicyManager
impl Sync for LifecyclePolicyManager
impl Unpin for LifecyclePolicyManager
impl UnwindSafe for LifecyclePolicyManager
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
Mutably borrows from an owned value. Read more
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>
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 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>
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