Sigil documentation
ReferenceRust referencesigil-compute

sigil-compute · facade

Source declarations, signatures and documentation for facade.

Source: sigil/node/sigil-compute/src/facade.rs. SHA-256: 86a71512e77a33a31e7e828ccbc2b3420bdad716c937b3f3a73694708f18a536.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

facade::ProviderCandidate

A candidate compute provider with normalized scoring factors.

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ProviderCandidate {
/// OAS DID of the provider.

pub provider_did: String,
/// Normalized price factor in \[0, 1\]. Lower is cheaper.

pub price_factor: f64,
/// Normalized latency factor in \[0, 1\]. Lower is faster.

pub latency_factor: f64,
/// OATS reputation score in \[0, 1\]. Higher is better.

pub reputation: f64,
/// Normalized capacity factor in \[0, 1\]. Higher means more available.

pub capacity_factor: f64
}

Source line: 21.

facade::ProviderSelector

Score-based provider selection for the compute marketplace.

pub struct ProviderSelector;

Source line: 35.

facade::ProviderSelector::score_provider

Compute a composite score for a provider.

Score = reputation * 0.35 + (1 - price) * 0.25

  • (1 - latency) * 0.25 + capacity * 0.15

All input factors should be normalized to [0, 1].

pub fn score_provider(
        price_factor: f64,
        latency_factor: f64,
        reputation: f64,
        capacity_factor: f64,
    ) -> f64;

Source line: 44.

facade::ProviderSelector::score

Score a ProviderCandidate.

pub fn score(candidate: &ProviderCandidate) -> f64;

Source line: 57.

facade::ProviderSelector::select_best

Select the best provider from a list of candidates.

Returns None if the list is empty.

pub fn select_best(providers: &[ProviderCandidate]) -> Option<&ProviderCandidate>;

Source line: 69.

facade::ProviderSelector::rank

Rank all candidates by descending score, returning scored pairs.

pub fn rank(providers: &[ProviderCandidate]) -> Vec<(&ProviderCandidate, f64)>;

Source line: 78.

On this page