pub struct CompressionRuleStore { /* private fields */ }Expand description
Persistence layer for TACO compression rules.
All rules are loaded at startup via CompressionRuleStore::list_active and cached in
super::RuleBasedCompressor. Hit counts are flushed in batches via
CompressionRuleStore::increment_hits during the maybe_autodream maintenance pass.
Implementations§
Source§impl CompressionRuleStore
impl CompressionRuleStore
Sourcepub async fn list_active(&self) -> Result<Vec<CompressionRule>, SqlxError>
pub async fn list_active(&self) -> Result<Vec<CompressionRule>, SqlxError>
Return all rules, ordered by ascending hit count (least-used first for pruning).
§Errors
Returns a database error on failure.
Sourcepub async fn upsert(&self, rule: &CompressionRule) -> Result<(), SqlxError>
pub async fn upsert(&self, rule: &CompressionRule) -> Result<(), SqlxError>
Insert or update a rule (keyed by (tool_glob, pattern)).
§Errors
Returns a database error on failure.
Sourcepub async fn increment_hits(
&self,
batch: &[(String, u64)],
) -> Result<(), SqlxError>
pub async fn increment_hits( &self, batch: &[(String, u64)], ) -> Result<(), SqlxError>
Batch-increment hit counts for a set of rule IDs.
Called during the maybe_autodream maintenance pass. Uses individual
UPDATE statements rather than a batch because the count of rules is small
and cross-backend portability is preferred.
§Errors
Returns a database error on failure.
Trait Implementations§
Source§impl Clone for CompressionRuleStore
impl Clone for CompressionRuleStore
Source§fn clone(&self) -> CompressionRuleStore
fn clone(&self) -> CompressionRuleStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CompressionRuleStore
impl !RefUnwindSafe for CompressionRuleStore
impl Send for CompressionRuleStore
impl Sync for CompressionRuleStore
impl Unpin for CompressionRuleStore
impl UnsafeUnpin for CompressionRuleStore
impl !UnwindSafe for CompressionRuleStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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