Skip to content

Commit 6a3966b

Browse files
committed
Document guarantees provided by Management API
Fixes haskell-distributed#241
1 parent ced056e commit 6a3966b

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

src/Control/Distributed/Process/Management.hs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,40 @@
7676
--
7777
-- * Whether messages will be taken from the mailbox first, or the event bus.
7878
--
79+
-- Since the event bus uses STM broadcast channels to communicate with agents,
80+
-- no message written to the bus successfully can be lost.
81+
--
82+
-- Agents can also receive messages via their mailboxes - these are subject to
83+
-- the same guarantees as all inter-process message sending.
84+
--
85+
-- Messages dispatched on an STM broadcast channel (i.e., management event bus)
86+
-- are guaranteed to be delivered with the same FIFO ordering guarantees that
87+
-- exist between two communicating processes, such that communication from the
88+
-- node controller's threads (i.e., MxEvent's) will never be re-ordered, but
89+
-- messages dispatched to the event bus by other processes (including, but not
90+
-- limited to agents) are only guaranteed to be ordered between one sender and
91+
-- one receiver.
92+
--
93+
-- No guarantee exists for the ordering in which messages sent to an agent's
94+
-- mailbox will be delivered, vs messages dispatched via the event bus.
95+
--
96+
-- Because of the above, there are no ordering guarantees for messages sent
97+
-- between agents, or for processes to agents, except for those that apply to
98+
-- messages sent between regular processes, since agents are
99+
-- implemented as such.
100+
--
101+
-- The event bus is serial and single threaded. Anything that is published by
102+
-- the node controller will be seen in FIFO order. There are no ordering
103+
-- guarantees pertaining to entries published to the event bus by other
104+
-- processes or agents.
105+
--
106+
-- It should not be possible to see, for example, an @MxReceived@ before the
107+
-- corresponding @MxSent@ event, since the places where we issue the @MxSent@
108+
-- write directly to the event bus (using STM) in the calling (green) thread,
109+
-- before dispatching instructions to the node controller to perform the
110+
-- necessary routing to deliver the message to a process (or registered name,
111+
-- or typed channel) locally or remotely.
112+
--
79113
-- [Management Data API]
80114
--
81115
-- Both management agents and clients of the API have access to a variety of
@@ -144,8 +178,6 @@
144178
-- > monitorNames = getSelfPid >>= nsend "name-monitor"
145179
-- > monitorNames2 = getSelfPid >>= mxNotify
146180
--
147-
-- For some real-world examples, see the distributed-process-platform package.
148-
--
149181
-- [Performance, Stablity and Scalability]
150182
--
151183
-- /Management Agents/ offer numerous advantages over regular processes:

0 commit comments

Comments
 (0)