moat-kv 0.71.0__py3-none-any.whl → 0.71.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- moat/kv/__init__.py +6 -7
- moat/kv/_cfg.yaml +3 -2
- moat/kv/actor/__init__.py +2 -1
- moat/kv/actor/deletor.py +4 -1
- moat/kv/auth/__init__.py +12 -13
- moat/kv/auth/_test.py +4 -1
- moat/kv/auth/password.py +11 -7
- moat/kv/backend/mqtt.py +4 -5
- moat/kv/client.py +20 -39
- moat/kv/code.py +3 -3
- moat/kv/command/data.py +4 -3
- moat/kv/command/dump/__init__.py +36 -34
- moat/kv/command/internal.py +2 -3
- moat/kv/command/job.py +1 -2
- moat/kv/command/type.py +3 -6
- moat/kv/data.py +9 -8
- moat/kv/errors.py +16 -8
- moat/kv/mock/__init__.py +2 -12
- moat/kv/model.py +29 -33
- moat/kv/obj/__init__.py +3 -3
- moat/kv/obj/command.py +3 -3
- moat/kv/runner.py +4 -5
- moat/kv/server.py +106 -126
- moat/kv/types.py +10 -12
- {moat_kv-0.71.0.dist-info → moat_kv-0.71.7.dist-info}/METADATA +6 -2
- moat_kv-0.71.7.dist-info/RECORD +47 -0
- {moat_kv-0.71.0.dist-info → moat_kv-0.71.7.dist-info}/WHEEL +1 -1
- moat_kv-0.71.7.dist-info/licenses/LICENSE +3 -0
- moat_kv-0.71.7.dist-info/licenses/LICENSE.APACHE2 +202 -0
- moat_kv-0.71.7.dist-info/licenses/LICENSE.MIT +20 -0
- moat_kv-0.71.7.dist-info/top_level.txt +1 -0
- build/lib/docs/source/conf.py +0 -201
- build/lib/examples/pathify.py +0 -45
- build/lib/moat/kv/__init__.py +0 -19
- build/lib/moat/kv/_cfg.yaml +0 -93
- build/lib/moat/kv/_main.py +0 -91
- build/lib/moat/kv/actor/__init__.py +0 -98
- build/lib/moat/kv/actor/deletor.py +0 -139
- build/lib/moat/kv/auth/__init__.py +0 -444
- build/lib/moat/kv/auth/_test.py +0 -166
- build/lib/moat/kv/auth/password.py +0 -234
- build/lib/moat/kv/auth/root.py +0 -58
- build/lib/moat/kv/backend/__init__.py +0 -67
- build/lib/moat/kv/backend/mqtt.py +0 -71
- build/lib/moat/kv/client.py +0 -1025
- build/lib/moat/kv/code.py +0 -236
- build/lib/moat/kv/codec.py +0 -11
- build/lib/moat/kv/command/__init__.py +0 -1
- build/lib/moat/kv/command/acl.py +0 -180
- build/lib/moat/kv/command/auth.py +0 -261
- build/lib/moat/kv/command/code.py +0 -293
- build/lib/moat/kv/command/codec.py +0 -186
- build/lib/moat/kv/command/data.py +0 -265
- build/lib/moat/kv/command/dump/__init__.py +0 -143
- build/lib/moat/kv/command/error.py +0 -149
- build/lib/moat/kv/command/internal.py +0 -248
- build/lib/moat/kv/command/job.py +0 -433
- build/lib/moat/kv/command/log.py +0 -53
- build/lib/moat/kv/command/server.py +0 -114
- build/lib/moat/kv/command/type.py +0 -201
- build/lib/moat/kv/config.py +0 -46
- build/lib/moat/kv/data.py +0 -216
- build/lib/moat/kv/errors.py +0 -561
- build/lib/moat/kv/exceptions.py +0 -126
- build/lib/moat/kv/mock/__init__.py +0 -101
- build/lib/moat/kv/mock/mqtt.py +0 -159
- build/lib/moat/kv/mock/tracer.py +0 -63
- build/lib/moat/kv/model.py +0 -1069
- build/lib/moat/kv/obj/__init__.py +0 -646
- build/lib/moat/kv/obj/command.py +0 -241
- build/lib/moat/kv/runner.py +0 -1347
- build/lib/moat/kv/server.py +0 -2809
- build/lib/moat/kv/types.py +0 -513
- ci/rtd-requirements.txt +0 -4
- ci/test-requirements.txt +0 -7
- ci/travis.sh +0 -96
- debian/.gitignore +0 -7
- debian/changelog +0 -1435
- debian/control +0 -43
- debian/moat-kv/usr/lib/python3/dist-packages/docs/source/conf.py +0 -201
- debian/moat-kv/usr/lib/python3/dist-packages/examples/pathify.py +0 -45
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/__init__.py +0 -19
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/_cfg.yaml +0 -93
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/_main.py +0 -91
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/actor/__init__.py +0 -98
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/actor/deletor.py +0 -139
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/__init__.py +0 -444
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/_test.py +0 -166
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/password.py +0 -234
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/root.py +0 -58
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/backend/__init__.py +0 -67
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/backend/mqtt.py +0 -71
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/client.py +0 -1025
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/code.py +0 -236
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/codec.py +0 -11
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/__init__.py +0 -1
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/acl.py +0 -180
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/auth.py +0 -261
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/code.py +0 -293
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/codec.py +0 -186
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/data.py +0 -265
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/dump/__init__.py +0 -143
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/error.py +0 -149
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/internal.py +0 -248
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/job.py +0 -433
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/log.py +0 -53
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/server.py +0 -114
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/type.py +0 -201
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/config.py +0 -46
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/data.py +0 -216
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/errors.py +0 -561
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/exceptions.py +0 -126
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/__init__.py +0 -101
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/mqtt.py +0 -159
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/tracer.py +0 -63
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/model.py +0 -1069
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/obj/__init__.py +0 -646
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/obj/command.py +0 -241
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/runner.py +0 -1347
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/server.py +0 -2809
- debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/types.py +0 -513
- debian/moat-kv.postinst +0 -3
- debian/rules +0 -20
- debian/source/format +0 -1
- debian/watch +0 -4
- docs/Makefile +0 -20
- docs/make.bat +0 -36
- docs/source/TODO.rst +0 -61
- docs/source/_static/.gitkeep +0 -0
- docs/source/acls.rst +0 -80
- docs/source/auth.rst +0 -84
- docs/source/client_protocol.rst +0 -456
- docs/source/code.rst +0 -341
- docs/source/command_line.rst +0 -1187
- docs/source/common_protocol.rst +0 -47
- docs/source/conf.py +0 -201
- docs/source/debugging.rst +0 -70
- docs/source/extend.rst +0 -37
- docs/source/history.rst +0 -36
- docs/source/index.rst +0 -75
- docs/source/model.rst +0 -54
- docs/source/overview.rst +0 -83
- docs/source/related.rst +0 -89
- docs/source/server_protocol.rst +0 -450
- docs/source/startup.rst +0 -31
- docs/source/translator.rst +0 -244
- docs/source/tutorial.rst +0 -711
- docs/source/v3.rst +0 -168
- examples/code/transform.scale.yml +0 -21
- examples/code/transform.switch.yml +0 -82
- examples/code/transform.timeslot.yml +0 -63
- examples/pathify.py +0 -45
- moat/kv/codec.py +0 -11
- moat_kv-0.71.0.dist-info/RECORD +0 -188
- moat_kv-0.71.0.dist-info/top_level.txt +0 -9
- scripts/current +0 -15
- scripts/env +0 -8
- scripts/init +0 -39
- scripts/recover +0 -17
- scripts/rotate +0 -33
- scripts/run +0 -29
- scripts/run-all +0 -10
- scripts/run-any +0 -10
- scripts/run-single +0 -15
- scripts/success +0 -4
- systemd/moat-kv-recover.service +0 -21
- systemd/moat-kv-rotate.service +0 -20
- systemd/moat-kv-rotate.timer +0 -10
- systemd/moat-kv-run-all.service +0 -26
- systemd/moat-kv-run-all@.service +0 -25
- systemd/moat-kv-run-any.service +0 -26
- systemd/moat-kv-run-any@.service +0 -25
- systemd/moat-kv-run-single.service +0 -26
- systemd/moat-kv-run-single@.service +0 -25
- systemd/moat-kv.service +0 -27
- systemd/postinst +0 -7
- systemd/sysusers +0 -3
- {moat_kv-0.71.0.dist-info → moat_kv-0.71.7.dist-info}/licenses/LICENSE.txt +0 -0
docs/source/code.rst
DELETED
@@ -1,341 +0,0 @@
|
|
1
|
-
==============
|
2
|
-
Code in MoaT-KV
|
3
|
-
==============
|
4
|
-
|
5
|
-
MoaT-KV can store Python code and modules, either for direct use by your
|
6
|
-
client or for a runner daemon.
|
7
|
-
|
8
|
-
TODO: There is no dependency resolution. Thus, while you can store Python
|
9
|
-
modules in MoaT-KV, there's no guarantee yet that they'll actually be present
|
10
|
-
when your code loads.
|
11
|
-
|
12
|
-
|
13
|
-
++++
|
14
|
-
Code
|
15
|
-
++++
|
16
|
-
|
17
|
-
Python code stored in MoaT-KV is wrapped with a procedure context, mainly to
|
18
|
-
make returning a result more straightforward. This is done by indenting the
|
19
|
-
code before compiling it: don't depend on multi-line strings to be flush
|
20
|
-
left.
|
21
|
-
|
22
|
-
Storage
|
23
|
-
=======
|
24
|
-
|
25
|
-
The location for executable scripts is configurable and defaults to
|
26
|
-
":.moat.kv.code.proc". Scripts are stored as a dict with these attributes:
|
27
|
-
|
28
|
-
* ``code``: the actual text
|
29
|
-
|
30
|
-
* ``is_async``: a flag whether the procedure is synchronous (``None``),
|
31
|
-
sync but should run in a worker thread (``False``), or async (``True``).
|
32
|
-
|
33
|
-
* ``vars``: Required input variables of your procedure. Parameters not
|
34
|
-
mentioned here are still available as globals.
|
35
|
-
|
36
|
-
* ``requires``: modules which this code needs. XXX TODO
|
37
|
-
|
38
|
-
There's no way for code written for a specific async library to run under
|
39
|
-
another, with the possible exception of "asyncio on top of Trio" (via
|
40
|
-
``trio-asyncio``). MoaT-KV itself uses ``anyio`` in order to avoid the
|
41
|
-
problem. The author strongly recommends to follow this practice, if at all
|
42
|
-
possible.
|
43
|
-
|
44
|
-
The required modules must be stored in MoaT-KV. Accessing modules from your
|
45
|
-
Python installation or the virtualenv you've set up for MoaT-KV is of course
|
46
|
-
possible, but MoaT-KV does not try to keep them up-to-date for you.
|
47
|
-
|
48
|
-
If you want to run user code in your MoaT-KV module, call
|
49
|
-
``cr = await CodeRoot.as_handler(client)``. Then, run some code by
|
50
|
-
simply naming it: ``cr("forty.two")`` or ``cr(("forty","two"))`` will run
|
51
|
-
the code stored at ``:.moat.kv.code.proc.forty.two``. All arguments will be
|
52
|
-
passed to the stored code.
|
53
|
-
|
54
|
-
|
55
|
-
+++++++
|
56
|
-
Modules
|
57
|
-
+++++++
|
58
|
-
|
59
|
-
Python modules are stored to MoaT-KV as plain code.
|
60
|
-
|
61
|
-
Recursive dependencies are not allowed.
|
62
|
-
|
63
|
-
Storage
|
64
|
-
=======
|
65
|
-
|
66
|
-
The location for Python modules is configurable and defaults to
|
67
|
-
":.moat.kv.code.module". Modules are stored as a dict with these attributes:
|
68
|
-
|
69
|
-
* ``code``: the actual program text
|
70
|
-
|
71
|
-
* ``requires``: other modules which this module needs to be loaded.
|
72
|
-
|
73
|
-
Usage
|
74
|
-
=====
|
75
|
-
|
76
|
-
Call ``await ModuleRoot.as_handler(client)``. All modules in your MoaT-KV
|
77
|
-
store are loaded into the Python interpreter; use normal import statements
|
78
|
-
to access them.
|
79
|
-
|
80
|
-
TODO: Modules are not yet loaded incrementally.
|
81
|
-
|
82
|
-
|
83
|
-
+++++++
|
84
|
-
Runners
|
85
|
-
+++++++
|
86
|
-
|
87
|
-
The distributed nature of MoaT-KV lends itself to running arbitrary code on
|
88
|
-
any node that can accomodate it.
|
89
|
-
|
90
|
-
============
|
91
|
-
Runner types
|
92
|
-
============
|
93
|
-
|
94
|
-
MoaT-KV has three built-in types of code runners. All are organized by a "group"
|
95
|
-
tag. The "moat kv run all" command starts all jobs of a type, in a
|
96
|
-
specific group.
|
97
|
-
|
98
|
-
``moat kv run`` accepts a ``-g ‹group›`` option that tells the
|
99
|
-
system which group to use. If you don't use this option, the default group
|
100
|
-
is named ``default``.
|
101
|
-
|
102
|
-
All groups and all runners are distinct. Which nodes actually execute the
|
103
|
-
code you enter into MoaT-KV is determined solely by running ``moat kv
|
104
|
-
run all`` on them, with the appropriate options.
|
105
|
-
|
106
|
-
++++++++++++++++++
|
107
|
-
Single-node runner
|
108
|
-
++++++++++++++++++
|
109
|
-
|
110
|
-
This runner executes code on a specific node. This is useful e.g. if you
|
111
|
-
need to access non-redundant hardware, e.g. a 1wire bus connected to a
|
112
|
-
specific computer.
|
113
|
-
|
114
|
-
On the command line you access this runner with ``moat kv run -n
|
115
|
-
NAME``.
|
116
|
-
|
117
|
-
|
118
|
-
+++++++++++++++
|
119
|
-
Any-node runner
|
120
|
-
+++++++++++++++
|
121
|
-
|
122
|
-
This runner executes code on one of a group of nodes. Which node executes
|
123
|
-
the code is largely determined by chance, startup order, or phase of the
|
124
|
-
moon. This is useful when accessing redundant hardware, e.g. a radio
|
125
|
-
interface.
|
126
|
-
|
127
|
-
TODO: Load balancing is not yet implemented.
|
128
|
-
|
129
|
-
On the command line you access this runner with ``moat kv run``, i.e.
|
130
|
-
without using the ``-n ‹node›`` option.
|
131
|
-
|
132
|
-
+++++++++++++++
|
133
|
-
All-node runner
|
134
|
-
+++++++++++++++
|
135
|
-
|
136
|
-
This runner executes code on all members of a group of nodes. You access it
|
137
|
-
with ``moat kv run -n -``.
|
138
|
-
|
139
|
-
====================
|
140
|
-
Runner configuration
|
141
|
-
====================
|
142
|
-
|
143
|
-
Runner entries don't hold code; they merely point to it. The advantage is
|
144
|
-
that you can execute the same code with different parameters.
|
145
|
-
|
146
|
-
See :class:`moat.kv.runner.RunnerEntry` for details.
|
147
|
-
|
148
|
-
The actual runtime information is stored in a separate "state" node.
|
149
|
-
This avoids race conditions.
|
150
|
-
See :class:`moat.kv.runner.StateEntry` for details.
|
151
|
-
|
152
|
-
+++++++++
|
153
|
-
Variables
|
154
|
-
+++++++++
|
155
|
-
|
156
|
-
The runners pass a couple of variables to their code.
|
157
|
-
|
158
|
-
* _client
|
159
|
-
|
160
|
-
The MoaT-KV client instance. You can use it to access arbitraty MoaT-KV
|
161
|
-
data.
|
162
|
-
|
163
|
-
* _cfg
|
164
|
-
|
165
|
-
The current configuration.
|
166
|
-
|
167
|
-
* _cls
|
168
|
-
|
169
|
-
A dict (actually, `moat.kv.util.attrdict`) with various runner-related
|
170
|
-
message classes. Convenient if you want to avoid a cumbersome ``import``
|
171
|
-
statement in your code, since these are not part of MoaT-KV's public API.
|
172
|
-
|
173
|
-
* _digits
|
174
|
-
|
175
|
-
A reference to `moat.kv.util.digits`.
|
176
|
-
|
177
|
-
* _info (async only)
|
178
|
-
|
179
|
-
A queue for events. This queue receives various messages. See below.
|
180
|
-
|
181
|
-
* _log
|
182
|
-
|
183
|
-
A standard ``Logger`` object.
|
184
|
-
|
185
|
-
* _P
|
186
|
-
|
187
|
-
`moat.kv.util.P`, to decode a Path string to a Path object.
|
188
|
-
|
189
|
-
* _Path
|
190
|
-
|
191
|
-
`moat.kv.util.Path`, to convert a list of path elements to a Path object.
|
192
|
-
|
193
|
-
* _self (async only)
|
194
|
-
|
195
|
-
The controller. See `moat.kv.runner.CallAdmin`, below.
|
196
|
-
|
197
|
-
These variables, as well as the contents of the data associated with the
|
198
|
-
runner, are available as global variables.
|
199
|
-
|
200
|
-
Node Groups
|
201
|
-
===========
|
202
|
-
|
203
|
-
All runners are part of a group of nodes. The Any-Node runners use the
|
204
|
-
group to synchronize job startup.
|
205
|
-
|
206
|
-
Runners also forward the group's membership information to your code as it
|
207
|
-
changes. You can use this information to implement "emergency operation
|
208
|
-
when disconnected" or similar fallback strategies.
|
209
|
-
|
210
|
-
=========
|
211
|
-
CallAdmin
|
212
|
-
=========
|
213
|
-
|
214
|
-
Your code has access to a ``_self`` variable which contains a `CallAdmin` object.
|
215
|
-
The typical usage pattern is to start monitoring some MoaT-KV entries with
|
216
|
-
`CallAdmin.watch`, then iterate ``_info`` for the values of those entries.
|
217
|
-
When you get a `ReadyMsg` event, all values have been transmitted; you can
|
218
|
-
then set up some timeouts, set other values, access external services, and
|
219
|
-
do whatever else your code needs to do.
|
220
|
-
|
221
|
-
MoaT-KV client code requires an async context manager for most scoped
|
222
|
-
operations. Since a `CallAdmin` is scoped by definition, it can manage
|
223
|
-
these scopes for you. Thus, instead of writing boilerplate code like
|
224
|
-
this::
|
225
|
-
|
226
|
-
import anyio
|
227
|
-
import moat.kv.runner
|
228
|
-
"""
|
229
|
-
Assume we want to process changes from these two subtrees
|
230
|
-
for 100 seconds
|
231
|
-
"""
|
232
|
-
async with _client.watch(_P("some.special.path")) as w1:
|
233
|
-
async with _client.watch(P("some.other.path")) as w2:
|
234
|
-
q = anyio.create_queue() # q_s,q_r = anyio.create_memory_object_stream()
|
235
|
-
async def _watch(w):
|
236
|
-
async for msg in w:
|
237
|
-
await q.put(msg) # q_s.send(msg)
|
238
|
-
async def _timeout(t):
|
239
|
-
await anyio.sleep(t)
|
240
|
-
await process_timeout()
|
241
|
-
await _self.spawn(_watch, w1)
|
242
|
-
await _self.spawn(_watch, w2)
|
243
|
-
await _self.spawn(_timeout, 100)
|
244
|
-
async for msg in q: # q_r
|
245
|
-
await process_data(msg)
|
246
|
-
|
247
|
-
you can simplify this to::
|
248
|
-
|
249
|
-
await _self.watch(_P("some.special.path"))
|
250
|
-
await _self.watch(_P("some.other.path"))
|
251
|
-
await _self.timer(100)
|
252
|
-
async for msg in _info:
|
253
|
-
if msg is None:
|
254
|
-
return # system was stalled
|
255
|
-
elif isinstance(msg, _cls.TimerMsg):
|
256
|
-
await process_timeout()
|
257
|
-
elif isinstance(msg, _cls.ChangeMsg):
|
258
|
-
await process_data(msg.msg)
|
259
|
-
|
260
|
-
Distinguishing messages from different sources can be further simplified by
|
261
|
-
using distinct ``cls=`` parameters (subclasses of ``ChangeMsg`` and
|
262
|
-
``TimerMsg``) in your ``watch`` and ``timer`` calls, respectively.
|
263
|
-
|
264
|
-
By default, ``watch`` retrieves the current value on startup. Set
|
265
|
-
``fetch=False`` if you don't want that.
|
266
|
-
|
267
|
-
By default, ``watch`` only retrieves the named entry. Set ``max_depth=-1``
|
268
|
-
if you want all sub-entries. There's also ``min_depth`` if you should need
|
269
|
-
it.
|
270
|
-
|
271
|
-
If you use ``max_depth``, entries are returned in mostly-depth-first order.
|
272
|
-
It's "mostly" because updates may arrive at any time. A ``ReadyMsg``
|
273
|
-
message is sent when the subtree is complete.
|
274
|
-
|
275
|
-
The `CallAdmin.spawn` method starts a subtask.
|
276
|
-
|
277
|
-
`watch`, `timer`, and `spawn` each return an object which you can call
|
278
|
-
``await res.cancel()`` on, which causes the watcher, timer or task in
|
279
|
-
question to be terminated.
|
280
|
-
|
281
|
-
++++++++
|
282
|
-
Messages
|
283
|
-
++++++++
|
284
|
-
|
285
|
-
The messages in ``_info`` can be used to implement a state machine. If your
|
286
|
-
code is long-running and async, you should iterate them; if the queue is
|
287
|
-
full, your code may be halted. Alternately you'll get a `None` message.
|
288
|
-
That message indicates that the queue has stalled: you should exit.
|
289
|
-
|
290
|
-
The following message types are defined. You're free to ignore any you
|
291
|
-
don't recognize.
|
292
|
-
|
293
|
-
* CompleteState
|
294
|
-
|
295
|
-
There are at least N runners in the group. (N is specified as an argument
|
296
|
-
to ``run all``; making this configurable via MoaT-KV is TODO.)
|
297
|
-
|
298
|
-
* PartialState
|
299
|
-
|
300
|
-
There are some runners available, but more than one and fewer than N.
|
301
|
-
|
302
|
-
* DetachedState
|
303
|
-
|
304
|
-
There is no other runner available.
|
305
|
-
|
306
|
-
* BrokenState
|
307
|
-
|
308
|
-
Something else is wrong.
|
309
|
-
|
310
|
-
* ChangeMsg
|
311
|
-
|
312
|
-
An entry you're watching has changed. The message's ``value`` and
|
313
|
-
``path`` attributes contain relevant details. ``value`` doesn't exist if
|
314
|
-
the node has been deleted.
|
315
|
-
|
316
|
-
You can use the watcher's ``cls`` argument to subclass this message, to
|
317
|
-
simplify dispatching.
|
318
|
-
|
319
|
-
* TimerMsg
|
320
|
-
|
321
|
-
A timer has triggered. The message's ``msg`` attribute is the timer, i.e.
|
322
|
-
the value you got back from ``_self.timer``. You can use `Timer.run(delay)`
|
323
|
-
to restart the timer.
|
324
|
-
|
325
|
-
You can use the timer's ``cls`` argument to subclass this message, to
|
326
|
-
simplify dispatching.
|
327
|
-
|
328
|
-
* ReadyMsg
|
329
|
-
|
330
|
-
Startup is complete. This message is generated after all watchers have
|
331
|
-
started and sent their initial data. The ``msg`` attribute contains the
|
332
|
-
number of watchers.
|
333
|
-
|
334
|
-
This message may be generated multiple times because of race conditions;
|
335
|
-
you should check that the count is correct.
|
336
|
-
|
337
|
-
|
338
|
-
The ``…State`` messages can be useful to determine what level of redundancy
|
339
|
-
you currently have in the system. One application would be to send a
|
340
|
-
warning to the operator that some nodes might be down.
|
341
|
-
|