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.
Files changed (178) hide show
  1. moat/kv/__init__.py +6 -7
  2. moat/kv/_cfg.yaml +3 -2
  3. moat/kv/actor/__init__.py +2 -1
  4. moat/kv/actor/deletor.py +4 -1
  5. moat/kv/auth/__init__.py +12 -13
  6. moat/kv/auth/_test.py +4 -1
  7. moat/kv/auth/password.py +11 -7
  8. moat/kv/backend/mqtt.py +4 -5
  9. moat/kv/client.py +20 -39
  10. moat/kv/code.py +3 -3
  11. moat/kv/command/data.py +4 -3
  12. moat/kv/command/dump/__init__.py +36 -34
  13. moat/kv/command/internal.py +2 -3
  14. moat/kv/command/job.py +1 -2
  15. moat/kv/command/type.py +3 -6
  16. moat/kv/data.py +9 -8
  17. moat/kv/errors.py +16 -8
  18. moat/kv/mock/__init__.py +2 -12
  19. moat/kv/model.py +29 -33
  20. moat/kv/obj/__init__.py +3 -3
  21. moat/kv/obj/command.py +3 -3
  22. moat/kv/runner.py +4 -5
  23. moat/kv/server.py +106 -126
  24. moat/kv/types.py +10 -12
  25. {moat_kv-0.71.0.dist-info → moat_kv-0.71.7.dist-info}/METADATA +6 -2
  26. moat_kv-0.71.7.dist-info/RECORD +47 -0
  27. {moat_kv-0.71.0.dist-info → moat_kv-0.71.7.dist-info}/WHEEL +1 -1
  28. moat_kv-0.71.7.dist-info/licenses/LICENSE +3 -0
  29. moat_kv-0.71.7.dist-info/licenses/LICENSE.APACHE2 +202 -0
  30. moat_kv-0.71.7.dist-info/licenses/LICENSE.MIT +20 -0
  31. moat_kv-0.71.7.dist-info/top_level.txt +1 -0
  32. build/lib/docs/source/conf.py +0 -201
  33. build/lib/examples/pathify.py +0 -45
  34. build/lib/moat/kv/__init__.py +0 -19
  35. build/lib/moat/kv/_cfg.yaml +0 -93
  36. build/lib/moat/kv/_main.py +0 -91
  37. build/lib/moat/kv/actor/__init__.py +0 -98
  38. build/lib/moat/kv/actor/deletor.py +0 -139
  39. build/lib/moat/kv/auth/__init__.py +0 -444
  40. build/lib/moat/kv/auth/_test.py +0 -166
  41. build/lib/moat/kv/auth/password.py +0 -234
  42. build/lib/moat/kv/auth/root.py +0 -58
  43. build/lib/moat/kv/backend/__init__.py +0 -67
  44. build/lib/moat/kv/backend/mqtt.py +0 -71
  45. build/lib/moat/kv/client.py +0 -1025
  46. build/lib/moat/kv/code.py +0 -236
  47. build/lib/moat/kv/codec.py +0 -11
  48. build/lib/moat/kv/command/__init__.py +0 -1
  49. build/lib/moat/kv/command/acl.py +0 -180
  50. build/lib/moat/kv/command/auth.py +0 -261
  51. build/lib/moat/kv/command/code.py +0 -293
  52. build/lib/moat/kv/command/codec.py +0 -186
  53. build/lib/moat/kv/command/data.py +0 -265
  54. build/lib/moat/kv/command/dump/__init__.py +0 -143
  55. build/lib/moat/kv/command/error.py +0 -149
  56. build/lib/moat/kv/command/internal.py +0 -248
  57. build/lib/moat/kv/command/job.py +0 -433
  58. build/lib/moat/kv/command/log.py +0 -53
  59. build/lib/moat/kv/command/server.py +0 -114
  60. build/lib/moat/kv/command/type.py +0 -201
  61. build/lib/moat/kv/config.py +0 -46
  62. build/lib/moat/kv/data.py +0 -216
  63. build/lib/moat/kv/errors.py +0 -561
  64. build/lib/moat/kv/exceptions.py +0 -126
  65. build/lib/moat/kv/mock/__init__.py +0 -101
  66. build/lib/moat/kv/mock/mqtt.py +0 -159
  67. build/lib/moat/kv/mock/tracer.py +0 -63
  68. build/lib/moat/kv/model.py +0 -1069
  69. build/lib/moat/kv/obj/__init__.py +0 -646
  70. build/lib/moat/kv/obj/command.py +0 -241
  71. build/lib/moat/kv/runner.py +0 -1347
  72. build/lib/moat/kv/server.py +0 -2809
  73. build/lib/moat/kv/types.py +0 -513
  74. ci/rtd-requirements.txt +0 -4
  75. ci/test-requirements.txt +0 -7
  76. ci/travis.sh +0 -96
  77. debian/.gitignore +0 -7
  78. debian/changelog +0 -1435
  79. debian/control +0 -43
  80. debian/moat-kv/usr/lib/python3/dist-packages/docs/source/conf.py +0 -201
  81. debian/moat-kv/usr/lib/python3/dist-packages/examples/pathify.py +0 -45
  82. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/__init__.py +0 -19
  83. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/_cfg.yaml +0 -93
  84. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/_main.py +0 -91
  85. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/actor/__init__.py +0 -98
  86. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/actor/deletor.py +0 -139
  87. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/__init__.py +0 -444
  88. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/_test.py +0 -166
  89. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/password.py +0 -234
  90. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/root.py +0 -58
  91. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/backend/__init__.py +0 -67
  92. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/backend/mqtt.py +0 -71
  93. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/client.py +0 -1025
  94. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/code.py +0 -236
  95. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/codec.py +0 -11
  96. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/__init__.py +0 -1
  97. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/acl.py +0 -180
  98. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/auth.py +0 -261
  99. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/code.py +0 -293
  100. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/codec.py +0 -186
  101. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/data.py +0 -265
  102. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/dump/__init__.py +0 -143
  103. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/error.py +0 -149
  104. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/internal.py +0 -248
  105. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/job.py +0 -433
  106. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/log.py +0 -53
  107. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/server.py +0 -114
  108. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/type.py +0 -201
  109. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/config.py +0 -46
  110. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/data.py +0 -216
  111. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/errors.py +0 -561
  112. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/exceptions.py +0 -126
  113. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/__init__.py +0 -101
  114. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/mqtt.py +0 -159
  115. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/tracer.py +0 -63
  116. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/model.py +0 -1069
  117. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/obj/__init__.py +0 -646
  118. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/obj/command.py +0 -241
  119. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/runner.py +0 -1347
  120. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/server.py +0 -2809
  121. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/types.py +0 -513
  122. debian/moat-kv.postinst +0 -3
  123. debian/rules +0 -20
  124. debian/source/format +0 -1
  125. debian/watch +0 -4
  126. docs/Makefile +0 -20
  127. docs/make.bat +0 -36
  128. docs/source/TODO.rst +0 -61
  129. docs/source/_static/.gitkeep +0 -0
  130. docs/source/acls.rst +0 -80
  131. docs/source/auth.rst +0 -84
  132. docs/source/client_protocol.rst +0 -456
  133. docs/source/code.rst +0 -341
  134. docs/source/command_line.rst +0 -1187
  135. docs/source/common_protocol.rst +0 -47
  136. docs/source/conf.py +0 -201
  137. docs/source/debugging.rst +0 -70
  138. docs/source/extend.rst +0 -37
  139. docs/source/history.rst +0 -36
  140. docs/source/index.rst +0 -75
  141. docs/source/model.rst +0 -54
  142. docs/source/overview.rst +0 -83
  143. docs/source/related.rst +0 -89
  144. docs/source/server_protocol.rst +0 -450
  145. docs/source/startup.rst +0 -31
  146. docs/source/translator.rst +0 -244
  147. docs/source/tutorial.rst +0 -711
  148. docs/source/v3.rst +0 -168
  149. examples/code/transform.scale.yml +0 -21
  150. examples/code/transform.switch.yml +0 -82
  151. examples/code/transform.timeslot.yml +0 -63
  152. examples/pathify.py +0 -45
  153. moat/kv/codec.py +0 -11
  154. moat_kv-0.71.0.dist-info/RECORD +0 -188
  155. moat_kv-0.71.0.dist-info/top_level.txt +0 -9
  156. scripts/current +0 -15
  157. scripts/env +0 -8
  158. scripts/init +0 -39
  159. scripts/recover +0 -17
  160. scripts/rotate +0 -33
  161. scripts/run +0 -29
  162. scripts/run-all +0 -10
  163. scripts/run-any +0 -10
  164. scripts/run-single +0 -15
  165. scripts/success +0 -4
  166. systemd/moat-kv-recover.service +0 -21
  167. systemd/moat-kv-rotate.service +0 -20
  168. systemd/moat-kv-rotate.timer +0 -10
  169. systemd/moat-kv-run-all.service +0 -26
  170. systemd/moat-kv-run-all@.service +0 -25
  171. systemd/moat-kv-run-any.service +0 -26
  172. systemd/moat-kv-run-any@.service +0 -25
  173. systemd/moat-kv-run-single.service +0 -26
  174. systemd/moat-kv-run-single@.service +0 -25
  175. systemd/moat-kv.service +0 -27
  176. systemd/postinst +0 -7
  177. systemd/sysusers +0 -3
  178. {moat_kv-0.71.0.dist-info → moat_kv-0.71.7.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,1187 +0,0 @@
1
- ===================
2
- The MoaT-KV command
3
- ===================
4
-
5
- MoaT-KV extends the MoaT command line tool with the ``moat kv`` subcommand
6
- which provides various sub- and sub-sub-commands to run and control your
7
- server.
8
-
9
- moat.kv
10
- =======
11
-
12
- .. program:: moat kv
13
-
14
- The main entry point for all commands.
15
-
16
- .. option:: -h, --host <address>
17
-
18
- The address to connect to. Defaults to ``localhost``.
19
-
20
- This setting is also available as the ``connect.host`` configuration
21
- setting.
22
-
23
- .. option:: -p, --port <port>
24
-
25
- The port to connect to. Defaults to 27586.
26
-
27
- This setting is also available as the ``connect.port`` configuration
28
- setting.
29
-
30
- .. option:: -a, --auth <params>
31
-
32
- Parameters for authorizing this client. Use ``=file`` to load the data
33
- from a file, or ``method data=value…`` to provide them inline.
34
-
35
- The default is ``_anon``, i.e. no authorization.
36
-
37
- .. option:: -m, --metadata
38
-
39
- The results of many commands will include the metadata associated with the
40
- entry or entries in question. This allows you to safely modify a value.
41
-
42
-
43
- .. program:: moat kv server
44
-
45
- Run the MoaT-KV server.
46
-
47
- A MoaT-KV server holds all data and syncs with all other MoaT-KV servers.
48
- You can't run :program:`moat kv` unless you have at least one running
49
- server (except for the "server" and "dump" subcommands).
50
-
51
- There is no separate option to set the address for clients to connect to;
52
- use ``server.bind_default.port=57589`` (or your own port number) to change
53
- it from the default of ``27589``, or use a configuration file.
54
-
55
- .. option:: -l, --load <file>
56
-
57
- Pre-load the saved data from this file into the server before starting it.
58
-
59
- **Do not use this option with an out-of-date savefile.**
60
-
61
- .. option:: -s, --save <file>
62
-
63
- Log all changes to this file. This includes the initial data.
64
-
65
- This option is only used for testing. Use ``moat kv log dest`` in
66
- production use.
67
-
68
- .. option:: -i, --incremental
69
-
70
- Don't write the complete state to the save file.
71
-
72
- This option is of limited usefulness and only used for testing.
73
- Use ``moat kv log dest -i`` in production.
74
-
75
- A network of servers needs to contain some data before it becomes
76
- operational. When starting the first server, you can use an initial
77
-
78
- .. option:: -I, --init <value>
79
-
80
- Initialize the server by storing this value in the root entry.
81
-
82
- This option is only used for testing. Create initial content with
83
- ``moat kv dump init`` for production use.
84
-
85
- .. option:: -e, --eval
86
-
87
- Evaluate the initial value, as a standard Python expression.
88
-
89
- This option is only used for testing.
90
-
91
- You can also use :program:`moat kv data set` to update this value
92
- later.
93
-
94
- .. option:: name
95
-
96
- Each MoaT-KV server requires a unique name. If you recycle a name, the old
97
- server using it will die (unless your network is segmented – in that case,
98
- one or both will terminate some random time after the networks are
99
- reconnecting, and you'll get inconsistent data). So don't do that.
100
-
101
-
102
- .. program:: moat kv data
103
-
104
- Basic data access.
105
-
106
- .. option:: path
107
-
108
- Access the entry at this location.
109
-
110
-
111
- .. program:: moat kv data get
112
-
113
- Read a MoaT-KV value.
114
-
115
- If you read a sub-tree recursively, be aware that the whole subtree may
116
- be read before anything is printed. Use the ``monitor --state`` subcommand
117
- for incremental output.
118
-
119
- .. option:: -r, --recursive
120
-
121
- Print all entries below this entry.
122
-
123
- .. option:: -d, --as-dict <text>
124
-
125
- When you use this option, the data is printed as a dictionary.
126
- The argument of this option controls which key is used for the actual
127
- value; this string should not occur as a path element.
128
-
129
- The customary value to use is a single underscore.
130
-
131
- Using this option in conjunction with ``--recursive`` requires keeping
132
- the whole data set in memory before starting to print anything. This may
133
- take a long time or eat a lot of memory.
134
-
135
- When this option is not used, the result is emitted as a list. Each item
136
- consists of a dictionary with a single entry; the key is the item's
137
- path. Some YAML parsers might not like that.
138
-
139
- .. option:: -m, --mindepth <integer>
140
-
141
- When printing recursively, start at this depth off the given path.
142
-
143
- The default is zero, i.e. include the entry itself.
144
-
145
- .. option:: -M, --maxdepth <integer>
146
-
147
- When printing recursively, stop at this depth (inclusive).
148
-
149
- The default is to print the whole tree. Use ``1`` to print the entry itself
150
- (assuming that it has a value and you didn't use ``--mindepth=1``)
151
- and its immediate children.
152
-
153
-
154
- .. program:: moat kv data list
155
-
156
- List MoaT-KV values.
157
-
158
- This command is basically like ``moat kv data ‹path› get``, except that
159
- ``--recursive`` and ``empty`` are always set. ``mindepth`` and ``maxdepth``
160
- default to 1.
161
-
162
- .. option:: -r, --recursive
163
-
164
- Print all entries below this entry.
165
-
166
- .. option:: -d, --as-dict <text>
167
-
168
- When you use this option, the data is printed as a dictionary.
169
- The argument of this option controls which key is used for the actual
170
- value; this string should not occur as a path element.
171
-
172
- The customary value to use is a single underscore.
173
-
174
- Using this option in conjunction with ``--recursive`` requires keeping
175
- the whole data set in memory before starting to print anything. This may
176
- take a long time or eat a lot of memory.
177
-
178
- .. option:: -m, --mindepth <integer>
179
-
180
- When printing recursively, start at this depth off the given path.
181
-
182
- The default is zero, i.e. include the entry itself.
183
-
184
- .. option:: -M, --maxdepth <integer>
185
-
186
- When printing recursively, stop at this depth (inclusive).
187
-
188
- The default is to print the whole tree. Use ``1`` to print the entry itself
189
- (assuming that it has a value and you didn't use ``--mindepth=1``)
190
- and its immediate children.
191
-
192
-
193
- .. program:: moat kv data set
194
-
195
- Store a value at some MoaT-KV position.
196
-
197
- If you update a value, you should use :option:`--last` (preferred) or
198
- :option:`--prev` (if you must), to ensure that no other change collides
199
- with yours.
200
-
201
- When adding a new entry, use :option:`--new` to ensure that you don't
202
- accidentally overwrite something.
203
-
204
- .. option:: -v, --value <value>
205
-
206
- The value to store. This option is mandatory.
207
-
208
- .. option:: -e, --eval
209
-
210
- Treat the ``value`` as a Python expression, to store anything that's not a
211
- string.
212
-
213
- .. option:: -l, --last <node> <count>
214
-
215
- The chain link which last modified this entry.
216
-
217
- .. option:: -n, --new
218
-
219
- Use this option instead of ``--last`` or ``prev`` if the entry is new, or
220
- has been deleted.
221
-
222
- .. option:: -p, --prev <value>
223
-
224
- The value which this entry needs to have in order to be affected.
225
-
226
- Try not to use this option; ``--last`` is much better.
227
-
228
- This value is also affected by ``--eval``.
229
-
230
-
231
- .. program:: moat kv data delete
232
-
233
- Delete the value at some MoaT-KV position.
234
-
235
- If you delete a value, you should use :option:`--last` (preferred) or
236
- :option:`--prev` (if you must), to ensure that no other change collides
237
- with your deletion.
238
-
239
- Recursive changes only check the entry you mention on the command line.
240
-
241
- .. option:: -l, --last <node> <count>
242
-
243
- The chain link which last modified this entry.
244
-
245
- .. option:: -e, --eval
246
-
247
- Treat the ``value`` as a Python expression, to store anything that's not a
248
- string.
249
-
250
- .. option:: -p, --prev <value>
251
-
252
- The value which this entry needs to have in order to be affected.
253
-
254
- Try not to use this option; ``--last`` is much better.
255
-
256
- This value is also affected by ``--eval``.
257
-
258
-
259
- .. program:: moat kv data monitor
260
-
261
- Monitor changes to the state of an entry, or rather its subtree.
262
-
263
- .. option:: -s, --state
264
-
265
- Before emitting changes, emit the current state of this subtree.
266
-
267
- A flag entry will be printed when this step is completed.
268
-
269
- .. option:: -o, --only
270
-
271
- Only emit the value. This mode is ideal for monitoring an entry with a
272
- script or similar.
273
-
274
- This mode will only watch a single entry, not the whole tree. The command
275
- will exit silently if the value is deleted or, when ``--state`` is used,
276
- doesn't exist in the first place.
277
-
278
- .. note::
279
-
280
- The current state may already include updates, due to MoaT-KV's
281
- asynchonous nature. You should simply replace existing values.
282
-
283
- .. option:: -m, --msgpack
284
-
285
- Write the output as ``MsgPack`` data. XXX TODO
286
-
287
- The default is to use YAML.
288
-
289
-
290
- .. program:: moat kv data update
291
-
292
- Stream a list of changes from standard input to MoaT-KV. Paths in the data
293
- set are interpreted relative to the path given.
294
-
295
- .. option:: -m, --msgpack
296
-
297
- Interpret the input as ``MsgPack`` data. XXX TODO
298
-
299
- The default is to use YAML. XXX TODO
300
-
301
-
302
- .. program:: moat kv control
303
-
304
- Control your server. XXX TODO
305
-
306
-
307
- .. program:: moat kv log
308
-
309
-
310
- Control logging of changes on the server.
311
-
312
-
313
- .. program:: moat kv log dest
314
-
315
- Set the file to log to. The old file is closed as soon as the new file is
316
- ready (i.e. the current state is saved).
317
-
318
- .. option:: -i, --incremental
319
-
320
- The save file will only contain changes, but not the current state.
321
-
322
- .. option:: path
323
-
324
- The file to write to. Note that this file is on the server.
325
-
326
-
327
- .. program:: moat kv log save
328
-
329
- Save the current state of the server to this file.
330
-
331
- .. option:: path
332
-
333
- The file to write to. Note that this file is on the server.
334
-
335
-
336
- .. program:: moat kv log stop
337
-
338
- Stop logging.
339
-
340
-
341
- .. program:: moat kv auth
342
-
343
- Set up and change client authorization.
344
-
345
- If you have never setup authorization, this sub-subcommands' ``--help``
346
- options may not work. Use ``-m root`` as a workaround. XXX TODO
347
-
348
- .. option:: -m, --method <name>
349
-
350
- Affect the named method.
351
-
352
- MoaT-KV supports multiple authorization methods. The default is the one
353
- that has been changed to with ``moat kv auth init``.
354
-
355
- If you want to do anything with authorization, you'll need to use this
356
- flag to set up the initial users.
357
-
358
- See `Auth`.
359
-
360
-
361
- .. program:: moat kv auth init
362
-
363
- Set up this method.
364
-
365
- .. option:: -s, --switch
366
-
367
- Actually swtich to using this method. This is the default for initial
368
- set-up.
369
-
370
-
371
- .. program:: moat kv auth list
372
-
373
- List configured auth methods.
374
-
375
- XXX TODO
376
-
377
-
378
- .. program:: moat kv auth user
379
-
380
- Manage MoaT-KV users.
381
-
382
- Each authorization method has its own schema for validating users.
383
-
384
-
385
- .. program:: moat kv auth user add <key>=<value>…
386
-
387
- Add a new user.
388
-
389
- Example: ``moat kv -a root auth -m password user add name=foo password=barbaz``
390
-
391
- The identifier which you'd use to subsequently refer to that user is
392
- printed when this command completes.
393
-
394
- .. option:: <key>=<value>
395
-
396
- Set an auth-specific parameter. If you write ``password?`` instead of
397
- ``password=SomeSecret``, you tell MoaT-KV to read the actual data from the
398
- terminal (without echo) so that it won't show up in your history.
399
-
400
-
401
- .. program:: moat kv auth user mod <ident> <key>=<value>…
402
-
403
- Modify a user.
404
-
405
- .. option:: <ident>
406
-
407
- The identifier MoaT-KV has assigned to the user.
408
-
409
- .. option:: <key>=<value>
410
- Set an auth-specific parameter.
411
-
412
-
413
- .. program:: moat kv auth user param <ident> <type> <key>
414
-
415
- Modify a user's setting.
416
-
417
- .. option:: <ident>
418
-
419
- The identifier MoaT-KV has assigned to the user.
420
-
421
- .. option:: <type>
422
-
423
- The type of setting to modify. The server interprets "acl" and "conv".
424
-
425
- .. option:: <key>
426
-
427
- The type-dependent setting to use as stored in MoaT-KV. For ACLs the
428
- relevant record is added with ``moat kv acl set <key> …``, for data
429
- conversion ``moat kv codec convert <key> …``.
430
-
431
-
432
- .. program:: moat kv auth user auth
433
-
434
- Check that authorizing a user works.
435
-
436
- XXX TODO seems broken
437
-
438
- .. option:: options…
439
-
440
- Whichever auth options you'd normally use in ``moat kv -a TYPE …``.
441
-
442
-
443
- .. program:: moat kv auth user get
444
-
445
- Dump data of a user.
446
-
447
- .. option:: -c, --chain <int>
448
-
449
- The chain length to return, for subsequent modification.
450
-
451
- .. option:: ident
452
-
453
- The user identifier, as reported by ``add``.
454
-
455
-
456
- .. program:: moat kv auth user list
457
-
458
- List users.
459
-
460
- XXX TODO add verbosity
461
-
462
-
463
- .. program:: moat kv type
464
-
465
- Set up MoaT-KV's type control: verify the data that clients write.
466
-
467
- See :doc:`translator` for details.
468
-
469
-
470
- .. program:: moat kv type get
471
-
472
- Retrieve a type entry.
473
-
474
- .. option:: -y, --yaml
475
-
476
- Emit the schema as YAML data. Default: JSON.
477
-
478
- .. option:: -s, --script <filename>
479
-
480
- Save the script to this file. Default: include in the output.
481
-
482
- .. option:: -S, --schema <filename>
483
-
484
- Save the schema to this file. Default: include in the output.
485
-
486
- .. option:: name…
487
-
488
- The type data to retrieve.
489
-
490
-
491
- .. program:: moat kv type set
492
-
493
- Add or modify a type entry.
494
-
495
- For setting up a type, you need at least two good and one bad test value.
496
- (If there's only one possible good value, you don't need the entry; if
497
- there's no bad value you don't need the type check.)
498
-
499
- Type checks accumulate: Both 'good' and 'bad' test values for "int
500
- percent" must be accepted by "int".
501
-
502
- Tests can use Python code, a JSON schema, or both. In the latter case the
503
- schema is tested first.
504
-
505
- To modify a record, use ``moat kv type get <path>… > <tempfile>``, edit
506
- the tempfile, then restore with ``moat kv type set -d <tempfile> <path>…``.
507
-
508
- .. option:: -y, --yaml
509
-
510
- Read the schema as YAML. Default: JSON.
511
-
512
- .. option:: -s, --script <filename>
513
-
514
- Load the script from this file. Default: no script.
515
-
516
- .. option:: -S, --schema <filename>
517
-
518
- Load the schema from this file. Default: no schema.
519
-
520
- .. option:: -g <value>
521
-
522
- A known-good value to test the codec. It will be Python-evaluated.
523
-
524
- .. option:: -b <value>
525
-
526
- A known-bad value to test the codec. It will be Python-evaluated.
527
-
528
- .. option:: -a, --all
529
-
530
- Load the complete record from the ``script`` file.
531
-
532
- .. option:: name…
533
-
534
- The type data to set.
535
-
536
-
537
- .. program:: moat kv type match
538
-
539
- Read, set or delete type matches, i.e. which part of your MoaT-KV tree is
540
- constricted by which type.
541
-
542
- .. option:: -t, type <name>
543
-
544
- The type name to use. Use multiple `--type`` options to access subtypes.
545
- Skip this option to display which type corresponds to the given path.
546
-
547
- .. option:: -d, --delete
548
-
549
- Delete the match record instead of printing it.
550
-
551
- .. option:: path…
552
-
553
- The MoaT-KV entry to affect. Path elements '+' and '#' match exactly-one and
554
- one-or-more subpaths. The most specific path wins.
555
-
556
-
557
- .. program:: moat kv codec
558
-
559
- Set up codecs: manipulate the data that clients see, sort of like a
560
- database view.
561
-
562
- Codecs consist of code that encodes, i.e. converts to the user's view, and
563
- decodes, i.e. converts to the server's storage.
564
-
565
- Codecs cannot translate path names, or access other entries. The decoder may
566
- modify an existing entry (or rather, use the currently-stored version when
567
- assembling an entry's new value).
568
-
569
- Unlike types, the codec hierarchy is strictly for convenience.
570
-
571
-
572
- .. program:: moat kv codec get
573
-
574
- Retrieve information about a codec, including its scripts.
575
-
576
- .. option:: -e, --encode <file>
577
-
578
- The file which the encoder's Python code is written to.
579
-
580
- If this option is not used, the code is part of the script's output.
581
-
582
- .. option:: -d, --decode <file>
583
-
584
- The file which the decoder's Python code is written to.
585
-
586
- If this option is not used, the code is part of the script's output.
587
-
588
- .. option:: -s, --script <file>
589
-
590
- The YAML file to which to write any other data.
591
-
592
- This file will also contain the scripts, if not stored otherwise.
593
-
594
- .. option:: <name>
595
-
596
- The name of the codec group from which this codec should be retrieved.
597
-
598
- .. option:: <path>
599
-
600
- The MoaT-KV entry that would be affected. Path elements '+' and '#' match
601
- exactly-one and one-or-more subpaths. The most specific path wins.
602
-
603
-
604
- .. program:: moat kv codec set
605
-
606
- Add or modify a codec.
607
-
608
- To modify a codec, use ``moat kv codec get <path>… > <tempfile>``, edit the
609
- tempfile, then restore with ``moat kv codec set -d <tempfile> <path>…``.
610
-
611
- .. option:: -e, --encode <file>
612
-
613
- The file which contains the encoder's Python code.
614
-
615
- .. option:: -d, --decode <file>
616
-
617
- The file which contains the decoder's Python code.
618
-
619
- .. option:: -i, --in <source> <dest>
620
-
621
- A pair of test values for the decoding branch of the codec.
622
- Both are ``eval``-uated.
623
-
624
- .. option:: -o, --out <source> <dest>
625
-
626
- A pair of test values for the encoding branch of the codec.
627
- Both are ``eval``-uated.
628
-
629
- .. option:: -D, --data <file>
630
-
631
- The YAML file which contains any other data.
632
-
633
- Required: two arrays "in" and "out" containing tuples with before/after
634
- values for the decoder and encoder, respectively.
635
-
636
- You may store the scripts in this file, using "encode" and "decode" keys.
637
-
638
- .. option:: <name>
639
-
640
- The name of the codec group to which this codec should be saved or
641
- modified.
642
-
643
- .. option:: <path>
644
-
645
- The MoaT-KV entry to affect. Path elements '+' and '#' match exactly-one and
646
- one-or-more subpaths. The most specific path wins.
647
-
648
-
649
- .. program:: moat kv codec convert
650
-
651
- Read, set or delete codec matches, i.e. which part of your MoaT-KV tree is
652
- managed by which codec. To this effect, matches are tagged by a group name.
653
-
654
- Which codec group to apply to a given user is stored in that user's
655
- auxiliary data as ``conv=NAME``. If no such entry is present, that user's
656
- data are not converted.
657
-
658
- .. option:: -c, --codec
659
-
660
- The codec to use on the given path. Use this option multiple times if
661
- the codec has a multi-level name.
662
-
663
- .. option:: <name>
664
-
665
- The name of the codec group to which this codec should be saved or
666
- modified.
667
-
668
- .. option:: <path>
669
-
670
- The MoaT-KV entry to affect. Path elements '+' and '#' match exactly-one and
671
- one-or-more subpaths. The most specific path wins.
672
-
673
-
674
- .. program:: moat kv acl
675
-
676
- Manipulate access control lists stored in MoaT-KV.
677
-
678
-
679
- .. program:: moat kv acl list
680
-
681
- Generate a list of known ACLs.
682
-
683
-
684
- .. program:: moat kv acl get
685
-
686
- Retrieve the flags at a specific ACL path.
687
-
688
- If the path does not contain any flags, print ``-``.
689
-
690
- .. option:: <acl>
691
-
692
- The ACL to modify. Mandatory.
693
-
694
- .. option:: <path>
695
-
696
- The ACL path from which to retrieve the flags.
697
-
698
-
699
- .. program:: moat kv acl set
700
-
701
- Set the flags at a specific ACL path.
702
-
703
- .. option:: -a, --acl <MODES>
704
-
705
- The flag values to set. Start with ``+`` to add, ``-`` to remove modes.
706
- Use an empty argument (``''``) to remove all rights. A lone ``-``
707
- removes the entry.
708
-
709
- .. option:: <acl>
710
-
711
- The ACL to modify. Mandatory.
712
-
713
- .. option:: <path>
714
-
715
- The ACL path to add or modify.
716
-
717
-
718
- .. program:: moat kv acl test
719
-
720
- Check whether an ACL allows access.
721
-
722
- .. option:: -m, --mode <mode>
723
-
724
- Check this mode (single letter). The default is "x".
725
-
726
- .. option:: -a, --acl <acl>
727
-
728
- In addition to the user's current ACL, also check the flag on the named ACL.
729
-
730
- There is no indication which of the two failed. This is intentional.
731
-
732
- .. option:: <path>
733
-
734
- The path to check.
735
-
736
-
737
- .. program:: moat kv acl dump
738
-
739
- Dump an ACL's content.
740
-
741
- .. option:: -d, --as-dict TEXT
742
-
743
- Print as dictionary. ``TEXT`` is the key used for the ACL data.
744
-
745
- Default: Emit a list.
746
-
747
- Using this flag requires storing the whole ACL in memory, which is
748
- usually not a problem (unlike for data).
749
-
750
- .. option:: <name>
751
-
752
- The name of the ACL to dump. Mandatory.
753
-
754
- .. option:: <path>
755
-
756
- The path to start dumping at. Default: the root.
757
-
758
-
759
- .. program:: moat kv code
760
-
761
- Manipulate code stored in MoaT-KV.
762
-
763
-
764
- .. program:: moat kv code list
765
-
766
- List code snippets stored in MoaT-KV.
767
-
768
- .. option:: -d, --as-dict <text>
769
-
770
- When you use this option, the data is printed as a dictionary.
771
- The argument of this option controls which key is used for the actual
772
- value; this string should not occur as a path element.
773
-
774
- The customary value to use is a single underscore.
775
-
776
- Using this option in conjunction with ``--recursive`` requires keeping
777
- the whole data set in memory before starting to print anything. This may
778
- take a long time or eat a lot of memory.
779
-
780
- .. option:: -s, --short
781
-
782
- Print one-line entries.
783
-
784
- Incompatible with ``-f`` and ``-d``.
785
-
786
- .. option:: -f, --full
787
-
788
- Print the actual code.
789
-
790
- Otherwise, code is not printed and a "number of lines" ``info`` entry is
791
- generated (if missing).
792
-
793
- .. option:: -m, --mindepth <integer>
794
-
795
- When printing recursively, start at this depth off the given path.
796
-
797
- The default is zero, i.e. include the entry itself.
798
-
799
- .. option:: -M, --maxdepth <integer>
800
-
801
- When printing recursively, stop at this depth (inclusive).
802
-
803
- The default is to print the whole tree. Use ``1`` to print the entry itself
804
- (assuming that it has a value and you didn't use ``--mindepth=1``)
805
- and its immediate children.
806
-
807
- .. option:: path…
808
-
809
- List the code below this location.
810
-
811
-
812
- .. program:: moat kv code get
813
-
814
- Retrieve Python code stored in the server.
815
-
816
- .. option:: -s, --script <filename>
817
-
818
- Save the code to <filename> instead of including it in the output.
819
-
820
- .. option:: <path> …
821
-
822
- Path to the code in question.
823
-
824
-
825
- .. program:: moat kv code set
826
-
827
- Store or replace Python code stored in the server.
828
-
829
- This code will not run in the server; the purpose of these calls is to
830
- upload code for use by client runners.
831
-
832
- To modify some code, use ``moat kv code get <path>… > <tempfile>``, edit
833
- the tempfile, then restore with ``moat kv code set -d <tempfile> <path>…``.
834
-
835
- .. option:: -d, --data <filename>
836
-
837
- Load the metadata from this file.
838
-
839
- .. option:: -s, --script <filename>
840
-
841
- Load the code from this file.
842
-
843
- .. option:: -a, --async
844
-
845
- The code will run asynchronously, i.e. it may use ``async`` and ``await`` statements.
846
-
847
- You should only use the ``anyio`` module for sleeping, locking etc..
848
-
849
- .. option:: -t, --thread
850
-
851
- The code will run in a worker thread.
852
-
853
- This option is incompatible with ``--async``.
854
-
855
- .. option:: name…
856
-
857
- The path to the code to write.
858
-
859
- TODO: Old versions of the code continue to run; MoaT-KV does not yet restart users.
860
-
861
-
862
- .. program:: moat kv code module
863
-
864
- Manipulate modules stored in MoaT-KV.
865
-
866
- Modules are replaced immediately, but code using them is **not**
867
- auto-restarted.
868
-
869
- This code is experimental and frankly just plain wrong: Module loading is
870
- not deferred until "import" time. This code needs sever refactoring. For now, please store modules
871
- in the file system.
872
-
873
-
874
- .. program:: moat kv code module get
875
-
876
- Retrieve Python module stored in the server.
877
-
878
- .. option:: -s, --script <filename>
879
-
880
- Save the code to <filename> instead of including it in the output
881
-
882
- .. option:: <path> …
883
-
884
- Path to the code in question.
885
-
886
-
887
- .. program:: moat kv code module set
888
-
889
- Store or replace Python code stored in the server.
890
-
891
- This code will not run in the server; the purpose of these calls is to
892
- upload code for use by client-side runners.
893
-
894
- To modify a module, use ``moat kv code module get <path>… > <tempfile>``, edit
895
- the tempfile, then restore with ``moat kv code module set -d <tempfile> <path>…``.
896
-
897
- .. option:: -d, --data <filename>
898
-
899
- Load the metadata from this file.
900
-
901
- .. option:: -s, --script <filename>
902
-
903
- Load the module's code from this file.
904
-
905
- .. option:: name…
906
-
907
- The path to the code to set, below ``.moat kv code proc`` or whatever
908
- else is configured under ``codes``.
909
-
910
- TODO: Old versions of the code continue to run; MoaT-KV does not yet restart users.
911
-
912
-
913
-
914
- .. program:: moat kv job
915
-
916
- Subcommand for controlling and executing code stored in MoaT-KV.
917
-
918
- .. option:: -n, --node <node>
919
-
920
- The node where the code in question will run.
921
-
922
- Code marked with this option will run on exactly this node. The default
923
- is the local node name.
924
-
925
- .. option:: -g, --group <group>
926
-
927
- The group which the code in question shall run on.
928
-
929
- The default group is "all".
930
-
931
-
932
- .. program:: moat kv job run
933
-
934
- This is the actual runner, i.e. the program that runs stored tasks.
935
-
936
- This program does not terminate.
937
-
938
-
939
- .. program:: moat kv job info
940
-
941
- List available groups (or nodes, if ``-g -`` is used).
942
-
943
-
944
- .. program:: moat kv job list
945
-
946
- List available run entries.
947
-
948
- The output is YAML-formatted unless ``-t`` is used.
949
-
950
- .. option:: -d, --as-dict <text>
951
-
952
- When you use this option, the data is printed as a dictionary.
953
- Otherwise it's a list of dicts with the entries' path as single key.
954
-
955
- .. option:: -s, --state
956
-
957
- Add the current state.
958
-
959
- .. option:: -S, --state-only
960
-
961
- Only print the current state.
962
-
963
- .. option:: -t, --table
964
-
965
- Print a table with one line per job.
966
-
967
- .. option:: <prefix>
968
-
969
- Limit listing to this prefix.
970
-
971
-
972
- .. program:: moat kv run get
973
-
974
- Read a runner entry.
975
-
976
-
977
- .. program:: moat kv run set
978
-
979
- Create or change a runner entry.
980
-
981
- .. option:: -c, --code <code>
982
-
983
- Path to the code that this entry should execute. This value is either
984
- split by spaces or, if ``--eval`` is used, interpreted as a Python
985
- expression.
986
-
987
- .. option:: -t, --time <when>
988
-
989
- Time at which the runner should fire next. Seconds in the future.
990
-
991
- .. option:: -r, --repeat <seconds>
992
-
993
- Time after a successful execution when the runner should fire again.
994
-
995
- .. option:: -d, --delay <seconds>
996
-
997
- Time after an unsuccessful execution when the runner should fire again.
998
-
999
- .. option:: -k, --ok <seconds>
1000
-
1001
- If a task runs for longer than this many seconds, it's considered OK and
1002
- any error associated with it is cleared.
1003
-
1004
- Errors are also cleared when a task exits, which won't work for tasks
1005
- that typically do not.
1006
-
1007
- .. option:: -b, --backoff
1008
-
1009
- Back-off exponent. The effective delay is ``delay * backoff ^ n_failures``.
1010
-
1011
- To retry a failure immediately, simply use ``--time now``.
1012
-
1013
-
1014
- .. program:: moat kv internal
1015
-
1016
- Subcommand for viewing and modifying the internal state of a MoaT-KV server.
1017
-
1018
-
1019
- .. program:: moat kv internal dump
1020
-
1021
- This command emits MoaT-KV's internal state.
1022
-
1023
- The output is comparable to ``moat kv data dump -rd_``, but for internal
1024
- data.
1025
-
1026
- .. option:: <path> …
1027
-
1028
- Path prefix for MoaT-KV's internal data structure.
1029
-
1030
-
1031
- .. program:: moat kv internal state
1032
-
1033
- This command queries the internal state of a MoaT-KV server.
1034
-
1035
- All lists of ``tick`` values are sorted and consist of either single
1036
- entries, or ``[begin,end)`` tuples, i.e. the starting value is part of the
1037
- range but the end is not.
1038
-
1039
- .. option:: -y, --yaml
1040
-
1041
- Print the result of this operation as YAML data.
1042
-
1043
- .. option:: -n, --nodes
1044
-
1045
- Add a list of known nodes and their current ``tick`` value.
1046
-
1047
- .. option:: -d, --deleted
1048
-
1049
- Add a list of per-node deleted ``tick`` values, i.e. those whose entries
1050
- have been purged from the system.
1051
-
1052
- .. option:: -p, --present
1053
-
1054
- Add a list of per-node ``tick`` values which can be retrieved via
1055
- node+tick, i.e. for which a chain entry exists.
1056
-
1057
- .. option:: -s, --superseded
1058
-
1059
- Add a list of per-node ``tick`` values which have been superseded by
1060
- subsequent changes. This is returned as "known".
1061
-
1062
- .. option:: -m, --missing
1063
-
1064
- Add a list of per-node missing ``tick`` values, i.e. those neither in
1065
- the ``known`` list nor seen in any entries' chains.
1066
-
1067
- .. option:: -r, --remote-missing
1068
-
1069
- Add a list of per-node missing ``tick`` values that have been requested
1070
- from other servers.
1071
-
1072
- See `Server protocol <server_protocol>` for details.
1073
-
1074
-
1075
- .. program:: moat kv internal mark
1076
-
1077
- Mark ticks as known or deleted. This is used to clean up the ``missing``
1078
- range(s) when there's a consistency problem.
1079
-
1080
- .. option:: -d, --deleted
1081
-
1082
- Add the nodes to the ``deleted`` list instead of the ``known`` list. The
1083
- effect is that if they subsequently re-surcace they'll be ignored.
1084
-
1085
- .. option:: -b, --broadcast
1086
-
1087
- Send the changes to the whole network, not just the node you're a client
1088
- of. (The local node is still targeted first, to ensure that if your
1089
- message should crash the server at least it'll only crash one.)
1090
-
1091
- .. option:: <node>
1092
-
1093
- The node whose ticks shall be used.
1094
-
1095
- .. option:: <item> …
1096
-
1097
- The tick values you want to clear. Taken from the current ``missing``
1098
- list if not specified here; in this case, an empty ``node`` means to
1099
- take the whole list, not just the ones for ``node``.
1100
-
1101
-
1102
- .. program:: moat kv internal deleter
1103
-
1104
- Manage the list of nodes that collectively manage cleaning deleted entries from
1105
- the MoaT-KV tree.
1106
-
1107
- All of these nodes must be online for clean-up to work.
1108
-
1109
- .. option:: -d, --delete
1110
-
1111
- Remove the mentioned nodes. Default is to add them.
1112
-
1113
- .. option:: <node> …
1114
-
1115
- Nodes to add or delete. If none are given, list the current state, or (with
1116
- ``--delete``) clear the list, disabling node deletion.
1117
-
1118
- If you want to shut deletion down temporarily, you can also add a
1119
- nonexistent node to the list.
1120
-
1121
-
1122
- .. program:: moat kv error
1123
-
1124
- Manage errors.
1125
-
1126
-
1127
- .. program:: moat kv error dump
1128
-
1129
- Show currently-logged errors.
1130
-
1131
-
1132
- .. program:: moat kv error resolve
1133
-
1134
- Mark an error as handled.
1135
-
1136
- MoaT-KV does this itself, usually, but not if the node which caused the
1137
- problem is deleted.
1138
-
1139
-
1140
- .. program:: moat kv dump
1141
-
1142
- Various low-level data handling commands.
1143
-
1144
-
1145
- .. program:: moat kv dump cfg
1146
-
1147
- Display the current configuration data.
1148
-
1149
-
1150
- .. program:: moat kv dump file
1151
-
1152
- Unpack a file and show its contents as YAML.
1153
-
1154
- .. option:: <file>
1155
-
1156
- The name of the file to decode.
1157
-
1158
-
1159
- .. program:: moat kv dump init
1160
-
1161
- Create an initial data file.
1162
-
1163
- .. option:: <node>
1164
-
1165
- The node name of the MoaT-KV server that should load the initial file.
1166
-
1167
- .. option:: <file>
1168
-
1169
- The file to write. Typically ``/var/lib/moat/kv/%Y-%m-%d/0.dkv``.
1170
-
1171
-
1172
- .. program:: moat kv dump msg NAME…
1173
-
1174
- Monitor all back-end messages. (I.e. not just those from MoaT-KV.)
1175
- Decodes MsgPack messages. Display as YAML.
1176
-
1177
- .. option:: NAME
1178
-
1179
- You may tell the monitor which stream to emit. By default it prints the
1180
- main server's update stream for data. You may use
1181
-
1182
- * some random sequence of names, which is used as-is as the topic to
1183
- monitor
1184
- * ``+NAME``, to monitor this sub-stream instead
1185
- * ``+`` to monitor all sub-streams (recursively; does not work with the
1186
- Serf backend)
1187
-