pub struct LinkedPeer {
pub runtime: String,
pub name: String,
pub features: Vec<String>,
}Expand description
A linked mesh runtime, as the mesh reports it. Those carrying the feature the
catalogue’s peers block names become advisors with the id peer:<runtime>.
use majordomus_cli::reasoning::availability::*;
use majordomus_cli::reasoning::catalogue::{AdvisorCatalogue, AdvisorTransport, 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\npeers:\n feature: reviews\n adapter: mesh-review\n capabilities: [code_review]\n",
).unwrap();
let peers = [
LinkedPeer { runtime: "n1-r1".into(), name: "one".into(), features: vec!["reviews".into()] },
LinkedPeer { runtime: "n2-r1".into(), name: "two".into(), features: vec![] },
];
let refs = References::default();
let states = derive_availability(&c, &Inputs {
refs: &refs, presence: &Nothing, mode: ReasoningMode::Standard, disabled: &[],
history: &[], peers: &peers, now: 0, cooldown: None,
});
assert_eq!(states.len(), 1, "only the peer carrying the feature is an advisor");
assert_eq!(states[0].id, "peer:n1-r1");
assert_eq!(states[0].transport, AdvisorTransport::Peer);Fields§
§runtime: String<node>-<runtime>.
name: StringIts display name.
features: Vec<String>The link features it carries; only those carrying the catalogue’s are advisors.
Trait Implementations§
Source§impl Clone for LinkedPeer
impl Clone for LinkedPeer
Source§fn clone(&self) -> LinkedPeer
fn clone(&self) -> LinkedPeer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LinkedPeer
impl Debug for LinkedPeer
impl Eq for LinkedPeer
Source§impl PartialEq for LinkedPeer
impl PartialEq for LinkedPeer
Source§fn eq(&self, other: &LinkedPeer) -> bool
fn eq(&self, other: &LinkedPeer) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LinkedPeer
Auto Trait Implementations§
impl Freeze for LinkedPeer
impl RefUnwindSafe for LinkedPeer
impl Send for LinkedPeer
impl Sync for LinkedPeer
impl Unpin for LinkedPeer
impl UnsafeUnpin for LinkedPeer
impl UnwindSafe for LinkedPeer
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
Mutably borrows from an owned value. Read more
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<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
Compare self to
key and return true if they are equal.