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
//! Event delivery from the R session to subscribed connections.
//!
//! Producers publish events through [`EventBus::publish`], which is safe to
//! call from synchronous R-thread code: it never waits for queue space or for
//! the network. An [`EventDispatcher`] task, running on the IPC server's
//! runtime, routes each event to the connections whose subscriptions match
//! and places it on that connection's bounded queue. The connection's writer
//! drains its [`EventStream`].
//!
//! ## Back-pressure
//!
//! * Every queue is limited by event count and by bytes ([`Limits`]); a single
//! event larger than `max_event_bytes` is rejected when published.
//! * A connection whose own queue overflows is disconnected; other
//! connections are unaffected.
//! * If the shared publish queue overflows, the dropped event is not lost
//! silently: the dispatcher is told and disconnects every connection whose
//! subscriptions may match what was dropped.
//!
//! Disconnected connections can observe why through
//! [`EventStream::disconnect_reason`].
//!
//! ## Topics and subscriptions
//!
//! A topic is a dot-separated name. Each segment is non-empty and made of
//! ASCII letters, digits, `_` and `-`; the whole name is at most 128 bytes.
//! Names starting with `arf.` are reserved for arf itself (see
//! [`Topic::external`]). A subscription pattern is an exact topic or
//! `prefix.*`, which matches every topic starting with `prefix.`.
//!
//! ## Ordering
//!
//! `seq` is assigned in publication order and the order is preserved through
//! both queues, so each connection receives its events in increasing `seq`.
//! Subscriptions apply from the moment the dispatcher routes an event, not
//! from when it was published. Connection ids and `seq` are shared across
//! the whole process, so they keep increasing even if the bus is recreated.
//!
//! ## The current bus
//!
//! Each run of the IPC server owns one bus. Producers without a handle to it
//! publish through `publish_event`, which reaches the bus of the server that
//! is running, or fails if there is none. A stopping server removes only the
//! bus it installed itself (identified by a generation number), so it can
//! never remove the bus of a server started after it.
pub use allocate_connection_id;
pub use ;
pub use publish_event;
pub use ;
pub use Event;
pub use SubscriptionPattern;
pub use install_r_event_publisher;
// Used by event producers, which are added separately from the server.
pub use ;
pub use EventDispatcher;