sigil-compute · selector
Source declarations, signatures and documentation for selector.
Source: sigil/node/sigil-compute/src/selector.rs. SHA-256: e11e549e82a7d3a5f31636511bf83927ddf3b1fe05c34ba973f4c05b515de313.
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.
selector::RequiredTier
Required tier for a job. Wider than VerificationTier because callers
may not care about T2's n_providers count when filtering.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum RequiredTier {
T1Optimistic,
T15Lumen,
T2Redundant,
T3Tee,
}Source line: 22.
selector::RequiredTier::matches
pub fn matches(self, declared: &VerificationTier) -> bool;Source line: 30.
selector::SelectorProviderStatus
Operational status — matches the on-chain enum.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum SelectorProviderStatus {
Active,
Suspended,
Exiting,
Exited,
}Source line: 44.
selector::SelectorProviderStatus::is_eligible
pub fn is_eligible(self) -> bool;Source line: 52.
selector::MacaCandidate
MACA-aware provider candidate. Extends the basic 4-factor candidate.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MacaCandidate {
pub provider_did: String,
/// Human root anchoring the provider (HMR DID). Used for distinct-root
/// constraints in T2 redundant verification.
pub human_root_did: Option<String>,
pub status: SelectorProviderStatus,
pub price_factor: f64,
pub latency_factor: f64,
pub reputation: f64,
pub capacity_factor: f64,
/// Penalty derived from `recent_challenges_lost / recent_challenges_total`.
/// Should be in `[0, 1]`. 0 = clean record; 1 = mostly lost.
pub recent_challenge_penalty: f64,
/// Liveness in `[0, 1]` — 1 = fully responsive to sentinel probes.
pub liveness: f64,
/// Declared verification tiers.
pub declared_tiers: Vec<VerificationTier>,
/// Declared model / capability identifiers (e.g. model family names).
pub capabilities: Vec<String>,
/// True when the provider's controller has presented an accepted ACT
/// or scoped authority context. Selectors used in privileged contexts
/// MUST treat `false` as ineligible.
pub authority_ok: bool
}Source line: 59.
selector::SelectionRequest
Required filter: model id + tier + authority.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SelectionRequest {
pub required_model: Option<String>,
pub required_tier: Option<RequiredTier>,
pub require_authority: bool,
/// Caller-provided diversity hint: providers whose human root appears in
/// this set are penalised (for T2 quorum diversity).
#[serde(default)]
pub already_selected_human_roots: Vec<String>
}Source line: 94.
selector::MacaWeights
Score weights. Defaults sum to 1.0 for the positive-direction terms; the challenge penalty / liveness penalty subtract independently.
#[derive(Debug, Clone, Copy)]
pub struct MacaWeights {
pub reputation: f64,
pub price: f64,
pub latency: f64,
pub capacity: f64,
pub liveness: f64,
pub root_diversity: f64,
pub challenge_penalty: f64
}Source line: 107.
selector::MacaProviderSelector
pub struct MacaProviderSelector;Source line: 131.
selector::MacaProviderSelector::score
Compute the MACA-aware score. The result is in (-∞, 1]. Higher is
better. Negative scores are theoretically possible when challenge
penalty + capacity drops outweigh the positive contribution; in
practice the comparator will simply rank such providers last.
pub fn score(
candidate: &MacaCandidate,
request: &SelectionRequest,
weights: &MacaWeights,
) -> f64;Source line: 138.
selector::MacaProviderSelector::is_eligible
Returns true when the candidate is eligible for this request.
pub fn is_eligible(candidate: &MacaCandidate, request: &SelectionRequest) -> bool;Source line: 190.
selector::MacaProviderSelector::select_deterministic
Deterministic selection. Filters out ineligible candidates, scores
the rest, and resolves ties by (score desc, provider_did asc) so
the result is reproducible across nodes.
pub fn select_deterministic<'a>(
candidates: &'a [MacaCandidate],
request: &SelectionRequest,
weights: &MacaWeights,
) -> Option<&'a MacaCandidate>;Source line: 213.
selector::MacaProviderSelector::select_redundant
Multi-pick selection used by T2 redundant verification. Greedily
picks the next-best candidate that does not share a human root with
any previously selected candidate. Returns up to n candidates.
pub fn select_redundant<'a>(
candidates: &'a [MacaCandidate],
request: &SelectionRequest,
weights: &MacaWeights,
n: usize,
) -> Vec<&'a MacaCandidate>;Source line: 234.