Skip to main content

AdaptiveTiering

Struct AdaptiveTiering 

Source
pub struct AdaptiveTiering<I: PatternIndex> {
    pub index: I,
    pub config: TierConfig,
    /* private fields */
}
Expand description

Pattern-aware tiering advisor.

Combines a PatternIndex with a TierConfig to suggest tier assignments based on the tiers of semantically similar blocks.

§Algorithm

Given a block’s metadata and a set of nearest neighbors (from the pattern index), each neighbor’s known tier contributes a weighted vote proportional to its cosine similarity. The tier with the highest cumulative vote is suggested, unless it matches the block’s current tier (in which case None is returned).

Fields§

§index: I

The underlying pattern vector index.

§config: TierConfig

Tiering configuration (thresholds, hysteresis, etc.).

Implementations§

Source§

impl<I: PatternIndex> AdaptiveTiering<I>

Source

pub fn new(index: I, config: TierConfig) -> Self

Create a new AdaptiveTiering with the given index and config.

Source

pub fn register_block(&mut self, key: BlockKey, tier: Tier)

Register (or update) the known tier for a block.

This must be called whenever a block changes tier so that suggest_tier can use accurate neighbor tier information for voting.

Source

pub fn remove_block(&mut self, key: BlockKey)

Remove a block from the tier registry and the pattern index.

Source

pub fn registered_count(&self) -> usize

Number of blocks registered in the tier map.

Source

pub fn suggest_tier( &self, meta: &BlockMeta, neighbors: &[(BlockKey, f32)], ) -> Option<Tier>

Suggest a tier for meta based on its nearest neighbors.

neighbors should be the output of PatternIndex::search_nearest: a list of (BlockKey, similarity) pairs. Each neighbor whose tier is known contributes a weighted vote. The tier with the highest total vote is returned, unless it matches the block’s current tier.

Returns None if:

  • neighbors is empty,
  • no neighbors have known tiers, or
  • the consensus tier matches the block’s current tier.

Auto Trait Implementations§

§

impl<I> Freeze for AdaptiveTiering<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for AdaptiveTiering<I>
where I: RefUnwindSafe,

§

impl<I> Send for AdaptiveTiering<I>
where I: Send,

§

impl<I> Sync for AdaptiveTiering<I>
where I: Sync,

§

impl<I> Unpin for AdaptiveTiering<I>
where I: Unpin,

§

impl<I> UnsafeUnpin for AdaptiveTiering<I>
where I: UnsafeUnpin,

§

impl<I> UnwindSafe for AdaptiveTiering<I>
where I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.