pub struct PopularityMap {
pub version: u32,
pub packages: HashMap<String, u64>,
}Expand description
Co-occurrence scores for conda packages across the full tool registry.
Key: package name. Value: how many tools in the registry include it. Higher score = more popular = deserves its own OCI layer.
Scores are computed by bv-builder pack from the registry’s specs/ tree
and committed as popularity.json. Each per-tool build reads this file and
uses it to decide which packages get solo layers vs. the long-tail layer.
Stability guarantee: scores are keyed by package NAME only, not version. A new version of an already-popular package (e.g. Python 3.11.6 replacing 3.11.5) inherits the same popularity score and therefore the same layer priority, which means it still gets a solo layer, just with a different digest. This bounds layer-order churn when popular packages are upgraded.
Fields§
§version: u32§packages: HashMap<String, u64>Package name → co-occurrence count (number of tools that list it).
Implementations§
Source§impl PopularityMap
impl PopularityMap
pub fn new() -> Self
pub fn load(path: &Path) -> Result<Self>
pub fn save(&self, path: &Path) -> Result<()>
Sourcepub fn score(&self, package_name: &str) -> u64
pub fn score(&self, package_name: &str) -> u64
Popularity score for a package, defaulting to 0 for unknowns.
Sourcepub fn record_tool(&mut self, package_names: &[String])
pub fn record_tool(&mut self, package_names: &[String])
Record that all package_names appear together in one tool.
Trait Implementations§
Source§impl Clone for PopularityMap
impl Clone for PopularityMap
Source§fn clone(&self) -> PopularityMap
fn clone(&self) -> PopularityMap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more