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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//! Active RPC — capability-based, promise-pipelined RPC for Active.
//!
//! Active RPC moves Active Infinity modules and capabilities between agents.
//! It is built around five ideas:
//!
//! 1. **Capabilities, not ambient authority.** A capability is an unforgeable
//! 128-bit id minted by a kernel. Holding it is the only permission needed,
//! attenuation can only narrow it, and dropping the last handle notifies the
//! provider.
//! 2. **Promises that pipeline.** A pending result can be passed to another
//! call, so a chain costs one provider round-trip instead of one per step.
//! 3. **Lanes and channels.** One agent runs many lanes with independent
//! budgets and speaks on many channels at once, including transfers of
//! capabilities.
//! 4. **Domain operations.** `evaluate`, `why`, `impact`, `subgraph` and `patch`
//! operate directly on Infinity modules under the capability's budget.
//! 5. **Transports as adapters.** In-process, shared memory, TCP, QUIC and a
//! gRPC/Connect bridge carry the same envelope, so capability semantics do
//! not depend on the wire.
//!
//! # Example
//!
//! ```
//! use active_rpc::cap::CapAttrs;
//! use active_rpc::domain::ModuleProvider;
//! use active_rpc::value::{Arg, Value};
//! use active_rpc::{Agent, Budget};
//!
//! # fn main() -> Result<(), active_rpc::Error> {
//! // A module capability with a call budget.
//! let mut provider = ModuleProvider::new();
//! let object = provider.install(active_rpc::domain::module_from_source(
//! "port = 8080\n",
//! "demo.active",
//! )?);
//! let agent = Agent::new();
//! let provider_id = agent.register(Box::new(provider));
//! let cap = agent.mint(provider_id, object, CapAttrs::new(&["stats"]))?;
//! let lane = agent.create_lane("main", Budget::default())?;
//!
//! let promise = agent.call(lane, &cap, "stats", vec![])?;
//! let stats = promise.value()?;
//! assert!(matches!(stats, Value::Map(_)));
//! # Ok(())
//! # }
//! ```
// item-level docs live in the specs; see docs/spec/wire.md
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Crate version.
pub const VERSION: &str = env!;
/// Protocol version carried in every envelope.
pub const PROTOCOL_VERSION: u8 = VERSION;
/// Methods every module capability can be granted.
pub const MODULE_METHODS: & = METHODS;