MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / fraction_for

Method fraction_for

nodedb/src/config/engine.rs:86–104  ·  view source on GitHub ↗

The configured budget fraction for `engine`. Exhaustive `match`: adding a new `EngineId` is a compile error here until it is given a fraction, which guarantees `to_byte_budgets` (and therefore the governor) can never silently omit an engine.

(&self, engine: EngineId)

Source from the content-addressed store, hash-verified

84 /// until it is given a fraction, which guarantees `to_byte_budgets`
85 /// (and therefore the governor) can never silently omit an engine.
86 fn fraction_for(&self, engine: EngineId) -> f64 {
87 match engine {
88 EngineId::Vector => self.vector_budget_fraction,
89 EngineId::Graph => self.graph_budget_fraction,
90 EngineId::DocumentSchemaless => self.document_schemaless_budget_fraction,
91 EngineId::DocumentStrict => self.document_strict_budget_fraction,
92 EngineId::Kv => self.kv_budget_fraction,
93 EngineId::Columnar => self.columnar_budget_fraction,
94 EngineId::Timeseries => self.timeseries_budget_fraction,
95 EngineId::Spatial => self.spatial_budget_fraction,
96 EngineId::Array => self.array_budget_fraction,
97 EngineId::Fts => self.fts_budget_fraction,
98 EngineId::Sparse => self.sparse_budget_fraction,
99 EngineId::Crdt => self.crdt_budget_fraction,
100 EngineId::Query => self.query_budget_fraction,
101 EngineId::Wal => self.wal_budget_fraction,
102 EngineId::Bridge => self.bridge_budget_fraction,
103 }
104 }
105
106 /// Sum of all engine fractions. Must be `<= 1.0`.
107 pub fn total_fraction(&self) -> f64 {

Callers 3

total_fractionMethod · 0.80
validateMethod · 0.80
to_byte_budgetsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected