1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! The bus described: what each address carries, asked of the bus itself
//! (services the runtime provides) — discovery, checking, bindings.
use yog_data::{Schema, Value};
/// What an address is.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Schema)]
pub enum AddressKind {
/// Emitted; anyone listens.
Event,
/// Called; one provider answers.
Service,
}
/// An address's descriptor.
#[derive(Debug, Clone, PartialEq, Schema)]
pub struct Descriptor {
pub address: String,
pub kind: AddressKind,
pub doc: String,
/// The payload's shape (`yog_data::Shape::describe`).
pub shape: Value,
/// A service's reply's shape.
pub reply: Option<Value>,
/// The interfaces it implements (`yog:energy/storage`): what [`Find`] finds it by.
#[data(default)]
pub interfaces: Vec<String>,
}
/// Every address under `prefix` (`pipes:`, `yog:event/player/`; empty: all).
#[derive(Debug, Clone, Schema)]
pub struct List {
pub prefix: String,
}
/// An address's descriptor.
#[derive(Debug, Clone, Schema)]
pub struct Describe {
pub address: String,
}
/// The addresses implementing `interface`.
#[derive(Debug, Clone, Schema)]
pub struct Find {
pub interface: String,
}