pub struct AdvisorState {Show 13 fields
pub id: String,
pub title: String,
pub transport: AdvisorTransport,
pub adapter: String,
pub capabilities: Vec<String>,
pub model: Option<String>,
pub executable: Option<String>,
pub credential: Option<String>,
pub status: AdvisorStatus,
pub reason: String,
pub probe: String,
pub recovering: bool,
pub circuit: Option<AdvisorCircuit>,
}Expand description
One advisor as it stands now: what the catalogue declares of it, its status, the one
machine word saying why, and what was probed. The row reasoning.advisors reports and
the policy plans over.
use majordomus_cli::reasoning::availability::*;
use majordomus_cli::reasoning::catalogue::{AdvisorCatalogue, References};
struct Nothing;
impl Presence for Nothing {
fn executable(&self, _: &str) -> bool { false }
fn variable(&self, _: &str) -> bool { false }
}
let c: AdvisorCatalogue = majordomus_cli::metadata::yaml::parse_into(
"version: 1\ncapabilities:\n - id: code_review\n description: x\nadvisors:\n - id: a\n title: A\n transport: local_runtime\n adapter: a-rt\n executable: rt\n capabilities: [code_review]\n",
).unwrap();
let refs = References::default();
let state: AdvisorState = derive_availability(&c, &Inputs {
refs: &refs, presence: &Nothing, mode: ReasoningMode::Standard, disabled: &[],
history: &[], peers: &[], now: 0, cooldown: None,
})
.remove(0);
assert_eq!((state.id.as_str(), state.status), ("a", AdvisorStatus::Unavailable));
assert_eq!(state.probe, "executable rt on PATH");
assert!(state.circuit.is_none() && !state.recovering);Fields§
§id: StringThe advisor id (a peer is peer:<runtime>).
title: StringThe human name.
transport: AdvisorTransportHow it is reached.
adapter: StringThe adapter that speaks to it.
capabilities: Vec<String>The advisory capabilities it offers.
model: Option<String>The model it asks, when the catalogue names one: what its adapter sends.
executable: Option<String>The executable its adapter runs, when it runs one.
credential: Option<String>The name of the credential variable its adapter reads — a name, never a value.
status: AdvisorStatusIts standing.
reason: StringWhy, as one machine word: present, executable_not_found, credential_absent,
mode_ci, mode_offline, disabled_by_configuration, consecutive_failures,
rate_limited, authentication_failed, peer_linked.
probe: StringWhat was observed, for a person: which executable, which variable (never a value).
recovering: boolAvailable again after an open circuit’s cooldown: the next consultation is its test.
circuit: Option<AdvisorCircuit>The open circuit, when there is one.
Trait Implementations§
Source§impl Clone for AdvisorState
impl Clone for AdvisorState
Source§fn clone(&self) -> AdvisorState
fn clone(&self) -> AdvisorState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AdvisorState
impl Debug for AdvisorState
Source§impl<'de> Deserialize<'de> for AdvisorState
impl<'de> Deserialize<'de> for AdvisorState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AdvisorState
Source§impl JsonSchema for AdvisorState
impl JsonSchema for AdvisorState
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for AdvisorState
impl PartialEq for AdvisorState
Source§fn eq(&self, other: &AdvisorState) -> bool
fn eq(&self, other: &AdvisorState) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for AdvisorState
impl Serialize for AdvisorState
impl StructuralPartialEq for AdvisorState
Auto Trait Implementations§
impl Freeze for AdvisorState
impl RefUnwindSafe for AdvisorState
impl Send for AdvisorState
impl Sync for AdvisorState
impl Unpin for AdvisorState
impl UnsafeUnpin for AdvisorState
impl UnwindSafe for AdvisorState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.