pub struct MeshConfig {
pub schema: String,
pub kind: String,
pub id: String,
pub enabled: bool,
pub multicast: MulticastConfig,
pub broadcast: BroadcastConfig,
pub rendezvous: RendezvousConfig,
pub trust: TrustConfig,
pub cooperation: CooperationConfig,
}Expand description
The whole declaration: the master switch and one section per mechanism. Unknown keys are refused, so a typo is an error and not a silently ignored wish.
Fields§
§schema: StringThe format version: mesh/v1.
kind: StringThe kind: mesh, the same word the discovery class carries.
id: StringThe declaration’s identity.
enabled: boolThe master switch. false starts nothing.
multicast: MulticastConfigUDP multicast, the preferred LAN mechanism.
broadcast: BroadcastConfigUDP broadcast, the controlled fallback.
rendezvous: RendezvousConfigRendezvous endpoints, for networks multicast cannot cross.
trust: TrustConfigWho to trust.
cooperation: CooperationConfigCooperation: the authenticated links to trusted runtimes of the same repository, and the journal they replicate (ADR 0067).
Implementations§
Source§impl MeshConfig
impl MeshConfig
Sourcepub fn parse(object: &Object) -> Result<MeshConfig, MeshError>
pub fn parse(object: &Object) -> Result<MeshConfig, MeshError>
Parse one indexed object into a mesh declaration, or say why it is not one: the wrong schema version, an unknown key, and a zero interval are each refused with the object’s URI in the reason.
Sourcepub fn from_metadata(
metadata: &Value,
uri: &str,
) -> Result<MeshConfig, MeshError>
pub fn from_metadata( metadata: &Value, uri: &str, ) -> Result<MeshConfig, MeshError>
MeshConfig::parse for a declaration that is not an indexed object: the metadata
mapping as the YAML subset parsed it, and the name to quote in a refusal. The trunk’s
copy of the declaration is read this way (see super::root).
use majordomus_cli::mesh::MeshConfig;
let ok = serde_json::json!({ "schema": "mesh/v1", "kind": "mesh-declaration", "id": "x" });
assert!(MeshConfig::from_metadata(&ok, "master:x.yaml").is_ok());
let wrong = serde_json::json!({ "schema": "mesh/v0", "kind": "mesh-declaration", "id": "x" });
assert!(MeshConfig::from_metadata(&wrong, "master:x.yaml").unwrap_err().to_string().contains("master:x.yaml"));Trait Implementations§
Source§impl Clone for MeshConfig
impl Clone for MeshConfig
Source§fn clone(&self) -> MeshConfig
fn clone(&self) -> MeshConfig
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 MeshConfig
impl Debug for MeshConfig
Source§impl<'de> Deserialize<'de> for MeshConfig
impl<'de> Deserialize<'de> for MeshConfig
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>,
Source§impl JsonSchema for MeshConfig
impl JsonSchema for MeshConfig
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 more