pub struct QuotaManager {
pub total_budget: usize,
pub detector: CategoryDetector,
pub category_quotas: HashMap<FileCategory, CategoryQuota>,
}Expand description
Manages budget quotas and density-greedy selection
Fields§
§total_budget: usize§detector: CategoryDetector§category_quotas: HashMap<FileCategory, CategoryQuota>Implementations§
Source§impl QuotaManager
impl QuotaManager
pub fn new(total_budget: usize) -> Result<QuotaManager, ScribeError>
Sourcepub fn classify_files<'a>(
&self,
scan_results: &'a [QuotaScanResult],
) -> HashMap<FileCategory, Vec<&'a QuotaScanResult>>
pub fn classify_files<'a>( &self, scan_results: &'a [QuotaScanResult], ) -> HashMap<FileCategory, Vec<&'a QuotaScanResult>>
Classify files into categories using references to avoid expensive cloning
Sourcepub fn calculate_density_score(
&self,
scan_result: &QuotaScanResult,
heuristic_score: f64,
) -> f64
pub fn calculate_density_score( &self, scan_result: &QuotaScanResult, heuristic_score: f64, ) -> f64
Calculate density score (importance per token) Density = importance_score / token_cost * priority_multiplier
Sourcepub fn select_files_density_greedy(
&self,
categorized_files: &HashMap<FileCategory, Vec<&QuotaScanResult>>,
heuristic_scores: &HashMap<String, f64>,
adaptation_factor: f64,
) -> Result<(Vec<QuotaScanResult>, HashMap<FileCategory, QuotaAllocation>), ScribeError>
pub fn select_files_density_greedy( &self, categorized_files: &HashMap<FileCategory, Vec<&QuotaScanResult>>, heuristic_scores: &HashMap<String, f64>, adaptation_factor: f64, ) -> Result<(Vec<QuotaScanResult>, HashMap<FileCategory, QuotaAllocation>), ScribeError>
Apply density-greedy selection algorithm with quotas
Sourcepub fn apply_quotas_selection(
&self,
scan_results: &[QuotaScanResult],
heuristic_scores: &HashMap<String, f64>,
) -> Result<(Vec<QuotaScanResult>, HashMap<FileCategory, QuotaAllocation>), ScribeError>
pub fn apply_quotas_selection( &self, scan_results: &[QuotaScanResult], heuristic_scores: &HashMap<String, f64>, ) -> Result<(Vec<QuotaScanResult>, HashMap<FileCategory, QuotaAllocation>), ScribeError>
Main entry point for quotas-based selection
Trait Implementations§
Auto Trait Implementations§
impl Freeze for QuotaManager
impl RefUnwindSafe for QuotaManager
impl Send for QuotaManager
impl Sync for QuotaManager
impl Unpin for QuotaManager
impl UnwindSafe for QuotaManager
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