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/common_protocol.rst
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
=================
|
2
|
-
MoaT-KV's protocol
|
3
|
-
=================
|
4
|
-
|
5
|
-
MoaT-KV's native protocol (both client/server and server/server) is based on
|
6
|
-
MsgPack. Strings must be valid UTF-8 and are distinct from binary buffers.
|
7
|
-
|
8
|
-
++++++++++++++++++
|
9
|
-
MsgPack Extensions
|
10
|
-
++++++++++++++++++
|
11
|
-
|
12
|
-
MoaT-KV is expected to be a transparent protocol. Unknown extensions
|
13
|
-
must not cause the reader to crash, and should be round-trip-safe: a client
|
14
|
-
which reads an object and modifies attribute A should not modify attribute
|
15
|
-
B even if B contains an element with an unknown extension.
|
16
|
-
|
17
|
-
This should, but currently does not, apply to extensions 2 and 3.
|
18
|
-
|
19
|
-
--------
|
20
|
-
DateTime
|
21
|
-
--------
|
22
|
-
|
23
|
-
A client must support MsgPack's Timestamp extension.
|
24
|
-
|
25
|
-
------
|
26
|
-
Bignum
|
27
|
-
------
|
28
|
-
|
29
|
-
Extension 2 is used for unsigned arbitrary-sized integers.
|
30
|
-
|
31
|
-
-----
|
32
|
-
Paths
|
33
|
-
-----
|
34
|
-
|
35
|
-
Extension 3 packages a MsgPack path.
|
36
|
-
|
37
|
-
MoaT-KV uses Path objects to refer to its nodes. Paths are lists which may
|
38
|
-
contain arbitrary msgpack data structures but should be limited to UTF-8
|
39
|
-
strings and non-negative integers.
|
40
|
-
|
41
|
-
A client must support both Path objects and plain lists when reading. It
|
42
|
-
should send Path elements. Using plain lists instead is supported but
|
43
|
-
not recommended.
|
44
|
-
|
45
|
-
In this documentation's protocol examples, Paths are shown as ``P('some.string')``
|
46
|
-
for readability.
|
47
|
-
|
docs/source/conf.py
DELETED
@@ -1,201 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
#
|
4
|
-
# Documentation build configuration file, created by
|
5
|
-
# sphinx-quickstart on Sat Jan 21 19:11:14 2017.
|
6
|
-
#
|
7
|
-
# This file is execfile()d with the current directory set to its
|
8
|
-
# containing dir.
|
9
|
-
#
|
10
|
-
# Note that not all possible configuration values are present in this
|
11
|
-
# autogenerated file.
|
12
|
-
#
|
13
|
-
# All configuration values have a default; values that are commented out
|
14
|
-
# serve to show the default.
|
15
|
-
|
16
|
-
# If extensions (or modules to document with autodoc) are in another directory,
|
17
|
-
# add these directories to sys.path here. If the directory is relative to the
|
18
|
-
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
19
|
-
#
|
20
|
-
import os
|
21
|
-
import sys
|
22
|
-
|
23
|
-
# So autodoc can import our package
|
24
|
-
sys.path.insert(0, os.path.abspath("../.."))
|
25
|
-
|
26
|
-
# Warn about all references to unknown targets
|
27
|
-
nitpicky = True
|
28
|
-
# Except for these ones, which we expect to point to unknown targets:
|
29
|
-
nitpick_ignore = [
|
30
|
-
# Format is ("sphinx reference type", "string"), e.g.:
|
31
|
-
("py:obj", "bytes-like"),
|
32
|
-
("py:class", "RangeSet"),
|
33
|
-
("py:class", "Any"),
|
34
|
-
]
|
35
|
-
|
36
|
-
autodoc_inherit_docstrings = False
|
37
|
-
|
38
|
-
# -- General configuration ------------------------------------------------
|
39
|
-
|
40
|
-
# If your documentation needs a minimal Sphinx version, state it here.
|
41
|
-
#
|
42
|
-
# needs_sphinx = '1.0'
|
43
|
-
|
44
|
-
# Add any Sphinx extension module names here, as strings. They can be
|
45
|
-
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
46
|
-
# ones.
|
47
|
-
extensions = [
|
48
|
-
"sphinx.ext.autodoc",
|
49
|
-
"sphinx.ext.intersphinx",
|
50
|
-
"sphinx.ext.coverage",
|
51
|
-
"sphinx.ext.napoleon",
|
52
|
-
"sphinxcontrib_trio",
|
53
|
-
]
|
54
|
-
|
55
|
-
intersphinx_mapping = {
|
56
|
-
"python": ("https://docs.python.org/3", None),
|
57
|
-
"trio": ("https://trio.readthedocs.io/en/stable", None),
|
58
|
-
}
|
59
|
-
|
60
|
-
autodoc_member_order = "bysource"
|
61
|
-
|
62
|
-
# Add any paths that contain templates here, relative to this directory.
|
63
|
-
templates_path = []
|
64
|
-
|
65
|
-
# The suffix(es) of source filenames.
|
66
|
-
# You can specify multiple suffix as a list of string:
|
67
|
-
#
|
68
|
-
# source_suffix = ['.rst', '.md']
|
69
|
-
source_suffix = ".rst"
|
70
|
-
|
71
|
-
# The master toctree document.
|
72
|
-
master_doc = "index"
|
73
|
-
|
74
|
-
# General information about the project.
|
75
|
-
project = "MoaT-KV"
|
76
|
-
copyright = "The MoaT-KV authors"
|
77
|
-
author = "The MoaT-KV authors"
|
78
|
-
|
79
|
-
# The version info for the project you're documenting, acts as replacement for
|
80
|
-
# |version| and |release|, also used in various other places throughout the
|
81
|
-
# built documents.
|
82
|
-
#
|
83
|
-
# The short X.Y version.
|
84
|
-
import pkg_resources
|
85
|
-
|
86
|
-
version = pkg_resources.get_distribution("moat.kv")._version
|
87
|
-
|
88
|
-
# The full version, including alpha/beta/rc tags.
|
89
|
-
release = version
|
90
|
-
|
91
|
-
# The language for content autogenerated by Sphinx. Refer to documentation
|
92
|
-
# for a list of supported languages.
|
93
|
-
#
|
94
|
-
# This is also used if you do content translation via gettext catalogs.
|
95
|
-
# Usually you set "language" from the command line for these cases.
|
96
|
-
language = None
|
97
|
-
|
98
|
-
# List of patterns, relative to source directory, that match files and
|
99
|
-
# directories to ignore when looking for source files.
|
100
|
-
# This patterns also effect to html_static_path and html_extra_path
|
101
|
-
exclude_patterns = []
|
102
|
-
|
103
|
-
# The name of the Pygments (syntax highlighting) style to use.
|
104
|
-
pygments_style = "sphinx"
|
105
|
-
|
106
|
-
# The default language for :: blocks
|
107
|
-
highlight_language = "python3"
|
108
|
-
|
109
|
-
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
110
|
-
todo_include_todos = False
|
111
|
-
|
112
|
-
|
113
|
-
# -- Options for HTML output ----------------------------------------------
|
114
|
-
|
115
|
-
# The theme to use for HTML and HTML Help pages. See the documentation for
|
116
|
-
# a list of builtin themes.
|
117
|
-
#
|
118
|
-
# html_theme = 'alabaster'
|
119
|
-
|
120
|
-
# We have to set this ourselves, not only because it's useful for local
|
121
|
-
# testing, but also because if we don't then RTD will throw away our
|
122
|
-
# html_theme_options.
|
123
|
-
import sphinx_rtd_theme
|
124
|
-
|
125
|
-
html_theme = "sphinx_rtd_theme"
|
126
|
-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
127
|
-
|
128
|
-
# Theme options are theme-specific and customize the look and feel of a theme
|
129
|
-
# further. For a list of options available for each theme, see the
|
130
|
-
# documentation.
|
131
|
-
#
|
132
|
-
html_theme_options = {
|
133
|
-
# default is 2
|
134
|
-
# show deeper nesting in the RTD theme's sidebar TOC
|
135
|
-
# https://stackoverflow.com/questions/27669376/
|
136
|
-
# I'm not 100% sure this actually does anything with our current
|
137
|
-
# versions/settings...
|
138
|
-
"navigation_depth": 4,
|
139
|
-
"logo_only": True,
|
140
|
-
}
|
141
|
-
|
142
|
-
# Add any paths that contain custom static files (such as style sheets) here,
|
143
|
-
# relative to this directory. They are copied after the builtin static files,
|
144
|
-
# so a file named "default.css" will overwrite the builtin "default.css".
|
145
|
-
html_static_path = ["_static"]
|
146
|
-
|
147
|
-
|
148
|
-
# -- Options for HTMLHelp output ------------------------------------------
|
149
|
-
|
150
|
-
# Output file base name for HTML help builder.
|
151
|
-
htmlhelp_basename = "moat.kv-doc"
|
152
|
-
|
153
|
-
|
154
|
-
# -- Options for LaTeX output ---------------------------------------------
|
155
|
-
|
156
|
-
latex_elements = {
|
157
|
-
# The paper size ('letterpaper' or 'a4paper').
|
158
|
-
#
|
159
|
-
# 'papersize': 'letterpaper',
|
160
|
-
# The font size ('10pt', '11pt' or '12pt').
|
161
|
-
#
|
162
|
-
# 'pointsize': '10pt',
|
163
|
-
# Additional stuff for the LaTeX preamble.
|
164
|
-
#
|
165
|
-
# 'preamble': '',
|
166
|
-
# Latex figure (float) alignment
|
167
|
-
#
|
168
|
-
# 'figure_align': 'htbp',
|
169
|
-
}
|
170
|
-
|
171
|
-
# Grouping the document tree into LaTeX files. List of tuples
|
172
|
-
# (source start file, target name, title,
|
173
|
-
# author, documentclass [howto, manual, or own class]).
|
174
|
-
latex_documents = [
|
175
|
-
(master_doc, "moat.kv.tex", "Trio Documentation", author, "manual"),
|
176
|
-
]
|
177
|
-
|
178
|
-
|
179
|
-
# -- Options for manual page output ---------------------------------------
|
180
|
-
|
181
|
-
# One entry per manual page. List of tuples
|
182
|
-
# (source start file, name, description, authors, manual section).
|
183
|
-
man_pages = [(master_doc, "moat.kv", "MoaT-KV Documentation", [author], 1)]
|
184
|
-
|
185
|
-
|
186
|
-
# -- Options for Texinfo output -------------------------------------------
|
187
|
-
|
188
|
-
# Grouping the document tree into Texinfo files. List of tuples
|
189
|
-
# (source start file, target name, title, author,
|
190
|
-
# dir menu entry, description, category)
|
191
|
-
texinfo_documents = [
|
192
|
-
(
|
193
|
-
master_doc,
|
194
|
-
"moat.kv",
|
195
|
-
"MoaT-KV Documentation",
|
196
|
-
author,
|
197
|
-
"MoaT-KV",
|
198
|
-
"A distributed no-master key-value store",
|
199
|
-
"Miscellaneous",
|
200
|
-
),
|
201
|
-
]
|
docs/source/debugging.rst
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
==============================
|
2
|
-
Fixing MoaT-KV network problems
|
3
|
-
==============================
|
4
|
-
|
5
|
-
As the MoaT-KV network is fully asynchronous, there's no way to avoid
|
6
|
-
getting into trouble – there's no arbitration of inconsistent data.
|
7
|
-
|
8
|
-
This document explains how to get back out, if necessary.
|
9
|
-
|
10
|
-
Missing data
|
11
|
-
============
|
12
|
-
|
13
|
-
See the `Server protocol <server_protocol>` for details on how MoaT-KV
|
14
|
-
works. From that document it's obvious that when a node increments its
|
15
|
-
``tick`` but the associated data gets lost (e.g. if the node or its Serf
|
16
|
-
agent crashes), you have a problem.
|
17
|
-
|
18
|
-
Worse: a server will not start if the "missing" list is non-empty. The
|
19
|
-
problem is that stale data causes difficult-to-resolve inconsistencies
|
20
|
-
when written to. TODO: allow the server to be in maintainer-only mode when
|
21
|
-
that happens.
|
22
|
-
|
23
|
-
First, run ``moat kv internal state -ndmrk``. Your output will look
|
24
|
-
somewhat like this::
|
25
|
-
|
26
|
-
deleted: # Ticks known to be deleted
|
27
|
-
test1:
|
28
|
-
- 12
|
29
|
-
known: # Ticks known to be superseded
|
30
|
-
test1:
|
31
|
-
- 1
|
32
|
-
- - 3
|
33
|
-
- 10
|
34
|
-
test2:
|
35
|
-
- 1
|
36
|
-
missing: # Ticks we need to worry about
|
37
|
-
test1:
|
38
|
-
- 2
|
39
|
-
node: test1 # the server we just asked
|
40
|
-
nodes: # all known nodes and their ticks
|
41
|
-
test1: 12
|
42
|
-
test2: 1
|
43
|
-
remote_missing: {} # used in recovery
|
44
|
-
tock: 82 # MoaT-KV's global event counter
|
45
|
-
|
46
|
-
This is not healthy: The ``missing`` element contains data. You can
|
47
|
-
manually mark the offending data as stale::
|
48
|
-
|
49
|
-
one $ moat kv internal mark test1 2
|
50
|
-
known:
|
51
|
-
test1:
|
52
|
-
- - 1
|
53
|
-
- 11
|
54
|
-
test2:
|
55
|
-
- 1
|
56
|
-
node: test1
|
57
|
-
tock: 92 # If this is not higher than before, clean your glasses ;-)
|
58
|
-
one $
|
59
|
-
|
60
|
-
This shows that the offending ``tick`` has been successfully added to the
|
61
|
-
``known`` list. Calling ``moat kv internal state -m`` verifies that
|
62
|
-
the list is now empty.
|
63
|
-
|
64
|
-
Use the ``--broadcast`` flag to send this message to all MoaT-KV servers,
|
65
|
-
not just the one you're a client of.
|
66
|
-
|
67
|
-
This action will allow the bad record to re-surface when the node that has
|
68
|
-
the record reconnects, assuming that there is one. You can use the ``mark``
|
69
|
-
command's ``--deleted`` flag to ensure that it will be discarded instead.
|
70
|
-
|
docs/source/extend.rst
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
================
|
2
|
-
Extending MoaT-KV
|
3
|
-
================
|
4
|
-
|
5
|
-
MoaT-KV comes with a built-in extension mechanism for its command line,
|
6
|
-
based on Python namespaces and import hackery.
|
7
|
-
|
8
|
-
Yor extension needs to ship a ``moat.kv.NAME`` module, with a
|
9
|
-
``_main.py`` file that exports a ``cli`` command (usually used as an
|
10
|
-
`asyncclick.group`). This adds the subcommand ``NAME`` to ``moat kv``.
|
11
|
-
|
12
|
-
Command line helper
|
13
|
-
===================
|
14
|
-
|
15
|
-
MoaT-KV commands follow a standard scheme (TODO some don't yet):
|
16
|
-
|
17
|
-
* what kind of object do you want to affect
|
18
|
-
* the name of the object to affect (or create)
|
19
|
-
* [ maybe start over with a sub-object ]
|
20
|
-
* the action you want to take
|
21
|
-
* some options affecting the action, and/or
|
22
|
-
* the generic set of parameter+value options (``-v``/``-e``/``-p``)
|
23
|
-
|
24
|
-
In order to simplify implementing that, there's a couple of helper methods.
|
25
|
-
|
26
|
-
`moat.kv.obj.command.std_command` takes a ``click.Group`` command and
|
27
|
-
attaches a subgroup with standard add/set/delete commands to it. The
|
28
|
-
new group is returned so you can attach more commands to it if you want.
|
29
|
-
|
30
|
-
`moat.util.attr_args` attaches MoaT-KV's generic parameter+value options.
|
31
|
-
|
32
|
-
`moat.util.process_args` takes a dict (usually) and the generic options'
|
33
|
-
variables (``set_``, ``vars_``, ``eval_``, ``path_``, ``proxy_``)
|
34
|
-
and applies them.
|
35
|
-
|
36
|
-
It's the caller's job to verify that the result is sane. TODO: support
|
37
|
-
using a validation library (probably jsonschema).
|
docs/source/history.rst
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
Release history
|
2
|
-
===============
|
3
|
-
|
4
|
-
.. currentmodule:: moat.kv
|
5
|
-
|
6
|
-
.. towncrier release notes start
|
7
|
-
|
8
|
-
Migration from DistKV
|
9
|
-
=====================
|
10
|
-
|
11
|
-
As of 2023-05, the protocol is unchanged.
|
12
|
-
|
13
|
-
To re-use the DistKV data as-is, copy ``/etc/distkv.cfg`` to
|
14
|
-
``/etc/moat/moat.cfg``. Then edit ``moat.cfg``:
|
15
|
-
|
16
|
-
* Move the ``logging:`` entry to the bottom if it isn't there already
|
17
|
-
* Indent everything above that entry two spaces
|
18
|
-
* Insert a line ``kv:`` as the first line of the file (not indented!)
|
19
|
-
|
20
|
-
Then, add these items as appropriate::
|
21
|
-
|
22
|
-
kv:
|
23
|
-
inv:
|
24
|
-
prefix: !P :.distkv.inventory
|
25
|
-
config:
|
26
|
-
prefix: !P :.distkv.config
|
27
|
-
errors:
|
28
|
-
prefix: !P :.distkv.errors
|
29
|
-
codes:
|
30
|
-
prefix: !P :.distkv.code.proc
|
31
|
-
modules:
|
32
|
-
prefix: !P :.distkv.code.module
|
33
|
-
runner:
|
34
|
-
prefix: !P :.distkv.run
|
35
|
-
state: !P :.distkv.state
|
36
|
-
|
docs/source/index.rst
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
.. documentation master file, created by
|
2
|
-
sphinx-quickstart on Sat Jan 21 19:11:14 2017.
|
3
|
-
You can adapt this file completely to your liking, but it should at least
|
4
|
-
contain the root `toctree` directive.
|
5
|
-
|
6
|
-
|
7
|
-
===============================================
|
8
|
-
MoaT-KV: A distributed no-master key-value store
|
9
|
-
===============================================
|
10
|
-
|
11
|
-
Rationale
|
12
|
-
=========
|
13
|
-
|
14
|
-
Any kind of distributed storage is subject to the CAP theorem (also called
|
15
|
-
"Brewer's theorem"): you can't get all of (global) Consistency,
|
16
|
-
Availability, and Partition tolerance. The problem is that you do want all
|
17
|
-
three of these.
|
18
|
-
|
19
|
-
One way around this problem is to recognize that on most KV storage
|
20
|
-
systems, any given record is rarely (if ever) changed by more than one
|
21
|
-
entity at the same time. Thus, a simple gossip protocol is sufficient
|
22
|
-
for distributing data.
|
23
|
-
|
24
|
-
MoaT-KV is intended to be used in a mostly-RAM architecture. There is no
|
25
|
-
disk-based storage backend; snapshots and event logs are used to restore a
|
26
|
-
system, if necessary.
|
27
|
-
|
28
|
-
See `Protocol Overview <overview.html>` for details about MoaT-KV's
|
29
|
-
choices.
|
30
|
-
|
31
|
-
API
|
32
|
-
===
|
33
|
-
|
34
|
-
MoaT-KV offers an efficient interface to access and change data.
|
35
|
-
|
36
|
-
|
37
|
-
Status
|
38
|
-
======
|
39
|
-
|
40
|
-
MoaT-KV is in production use as the backbone of the author's home and office
|
41
|
-
automation setup.
|
42
|
-
|
43
|
-
Note that as of MoaT-KV 0.30, multi-word paths were replaced with dotted
|
44
|
-
strings. Some pieces of documentation might still reflect the old style.
|
45
|
-
|
46
|
-
.. toctree::
|
47
|
-
:maxdepth: 2
|
48
|
-
|
49
|
-
overview.rst
|
50
|
-
tutorial.rst
|
51
|
-
startup.rst
|
52
|
-
command_line.rst
|
53
|
-
common_protocol.rst
|
54
|
-
client_protocol.rst
|
55
|
-
server_protocol.rst
|
56
|
-
auth.rst
|
57
|
-
acls.rst
|
58
|
-
code.rst
|
59
|
-
model.rst
|
60
|
-
translator.rst
|
61
|
-
debugging.rst
|
62
|
-
extend.rst
|
63
|
-
related.rst
|
64
|
-
|
65
|
-
TODO.rst
|
66
|
-
history.rst
|
67
|
-
|
68
|
-
====================
|
69
|
-
Indices and tables
|
70
|
-
====================
|
71
|
-
|
72
|
-
* :ref:`genindex`
|
73
|
-
* :ref:`modindex`
|
74
|
-
* :ref:`search`
|
75
|
-
* :ref:`glossary`
|
docs/source/model.rst
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
==========
|
2
|
-
Data Model
|
3
|
-
==========
|
4
|
-
|
5
|
-
This section documents some of MoaT-KV's server-internal classes.
|
6
|
-
|
7
|
-
|
8
|
-
.. automodule:: moat.kv.model
|
9
|
-
:members:
|
10
|
-
|
11
|
-
ACLs
|
12
|
-
----
|
13
|
-
|
14
|
-
ACL checks are performed by :class:`~moat.kv.types.ACLFinder`. This class
|
15
|
-
collects all relevant ACL entries for any given (sub)path, sorted by
|
16
|
-
depth-first specificty. This basically means that you collect all ACLs
|
17
|
-
that could possibly match a path and sort them; the ``+`` and ``#``
|
18
|
-
wildcards get sorted last. Then the system picks the first entry that
|
19
|
-
actually has a value.
|
20
|
-
|
21
|
-
This basically means that if you have a path ``a b c d e f g`` and ACLs ``a
|
22
|
-
b # g`` and ``a # d e f g``, the first ACL will match because ``b`` is
|
23
|
-
more specific than ``#``, even though the second ACL is longer and thus
|
24
|
-
could be regarded as being more specific. However, the current rule is more
|
25
|
-
stable when used with complex ACLs and thus more secure.
|
26
|
-
|
27
|
-
.. autoclass:: moat.kv.types.ACLFinder
|
28
|
-
:members:
|
29
|
-
|
30
|
-
Helper methods and classes
|
31
|
-
--------------------------
|
32
|
-
|
33
|
-
.. autoclass:: moat.kv.util.MsgWriter
|
34
|
-
:members:
|
35
|
-
|
36
|
-
.. automodule:: moat.kv.util
|
37
|
-
:members:
|
38
|
-
|
39
|
-
.. py:data:: moat.kv.util.NotGiven
|
40
|
-
|
41
|
-
This object marks the absence of information where simply not using the
|
42
|
-
data element or keyword at all would be inconvenient.
|
43
|
-
|
44
|
-
For instance, in ``def fn(value=NotGiven, **kw)`` you'd need to test
|
45
|
-
``'value' in kw``, or use an exception. The problem is that this would
|
46
|
-
not show up in the function's signature.
|
47
|
-
|
48
|
-
With ``NotGiven`` you can simply test ``value is`` (or ``is not``) ``NotGiven``.
|
49
|
-
|
50
|
-
.. automodule:: moat.kv.runner
|
51
|
-
:members:
|
52
|
-
|
53
|
-
.. automodule:: moat.kv.actor
|
54
|
-
:members:
|
docs/source/overview.rst
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
=======================
|
2
|
-
Principles of operation
|
3
|
-
=======================
|
4
|
-
|
5
|
-
MoaT-KV relies on the fact that on most KV storage systems, any given record
|
6
|
-
is rarely (if ever) changed by more than one entity at the same time. Thus,
|
7
|
-
a simple gossip protocol is sufficient for distributing data.
|
8
|
-
|
9
|
-
To recover from missed changes, each node in a MoaT-KV network maintains a
|
10
|
-
change counter ("tick"). All data records (:class:`moat.kv.model.Entry`) are
|
11
|
-
tagged with a chain of events (:class:`moat.kv.model.NodeEvent`), consisting
|
12
|
-
of the ``n`` most recent ``(node, tick)`` values which changed this
|
13
|
-
entry. Nodes do not appear in a chain more than once. Dropped ticks
|
14
|
-
are added to a per-node list of "known"(-to-have-been-superseded) counter
|
15
|
-
values.
|
16
|
-
|
17
|
-
The maximum chain length is determined by the number of partitions a MoaT-KV
|
18
|
-
network might split into. Thus the network guarantees that it is possible
|
19
|
-
which side of a split modified a record when the split is healed.
|
20
|
-
|
21
|
-
If both sides did, the conflict is resolved deterministically.
|
22
|
-
TODO: when this happens, send a notification to clients.
|
23
|
-
|
24
|
-
After a network split, a four-step protocol re-synchronizes the
|
25
|
-
participants:
|
26
|
-
|
27
|
-
* broadcast the current counters
|
28
|
-
|
29
|
-
* broadcast known-value and known-deleted lists
|
30
|
-
|
31
|
-
* broadcast a list of missing node events
|
32
|
-
|
33
|
-
* broadcast the missed data
|
34
|
-
|
35
|
-
MoaT-KV does not have a master node, much less a consensus-based election
|
36
|
-
system (Raft, Paxos, …). Instead, MoaT-KV uses an `asyncactor.Actor` to
|
37
|
-
compile a short list of available servers that's broadcast every few
|
38
|
-
seconds.
|
39
|
-
|
40
|
-
When a partitioned network is re-joined, the current housekeepers are
|
41
|
-
responsible for driving and monitoring the re-sync protocol.
|
42
|
-
|
43
|
-
|
44
|
-
Storage
|
45
|
-
=======
|
46
|
-
|
47
|
-
MoaT-KV is intended to be used in a mostly-RAM architecture. There is no
|
48
|
-
disk-based storage backend; snapshots and event logs are used to restore a
|
49
|
-
system, if necessary. Feeding old snapshots to a running system is mostly
|
50
|
-
benign, but see below.
|
51
|
-
|
52
|
-
MoaT-KV runs on top of MQTT.
|
53
|
-
It supports all data types that can be transmitted by
|
54
|
-
`MsgPack <https://github.com/msgpack/msgpack/blob/master/spec.md>`.
|
55
|
-
|
56
|
-
TODO: MsgPack has extension types, so constructing Python objects is possible.
|
57
|
-
|
58
|
-
Record Deletion
|
59
|
-
===============
|
60
|
-
|
61
|
-
Deleting data records is when MoaT-KV's synchronization protocol breaks
|
62
|
-
down, because MoaT-KV can't attach chains to records which no longer exist.
|
63
|
-
|
64
|
-
MoaT-KV fixes this by keeping a separate record of deleted entries, or
|
65
|
-
rather their chain links. This works well for mostly-static storages but
|
66
|
-
becomes a problem on more dynamic systems.
|
67
|
-
|
68
|
-
Thus, periodic clean-up is required. This is achieved by creating a
|
69
|
-
separate "Delete" Actor group which contains every system with persistent
|
70
|
-
storage plus one system per network that's not already covered.
|
71
|
-
|
72
|
-
When every node of this group is online, they periodically broadcast a
|
73
|
-
tuple of ``tock`` values: one which signals that deletions with earlier
|
74
|
-
``tock``\s may safely be flushed, and a high-water limit for the next
|
75
|
-
round.
|
76
|
-
|
77
|
-
A node that receives this tuple compares the received first value with the
|
78
|
-
last transmission's second. If it's higher, deletions may have been missed,
|
79
|
-
most likely due to a network outage between that node and the closest Delete
|
80
|
-
member. Since the records are now gone, the node will connect to one of the
|
81
|
-
Delete group members and send a list of each entry's last-change chain links.
|
82
|
-
The recipient will re-broadcast any misses as "new" deletions.
|
83
|
-
|
docs/source/related.rst
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
============================
|
2
|
-
Plugins and related software
|
3
|
-
============================
|
4
|
-
|
5
|
-
Additions to this list will be appreciated!
|
6
|
-
|
7
|
-
|
8
|
-
Home Assistant
|
9
|
-
==============
|
10
|
-
|
11
|
-
`Home Assistant`__ is a front-end for home automation. (Actually it's more
|
12
|
-
than that, but ``moat.kv`` uses it as a front-end and prefers to do the
|
13
|
-
automation part itself.)
|
14
|
-
|
15
|
-
`moat.kv-hass <https://github.com/M-o-a-T/disthass>`__ documents how to
|
16
|
-
connect Home Assistant to the ``moat.kv`` system and helps with creating the
|
17
|
-
data structures that teach Home Assistant about moat.kv-controlled sensors
|
18
|
-
and actors.
|
19
|
-
|
20
|
-
|
21
|
-
KNX
|
22
|
-
===
|
23
|
-
|
24
|
-
KNX is a serial bus for building control.
|
25
|
-
|
26
|
-
`knxd <https://github.com/knxd/knxd/>`__ is a server commonly used to talk to KNX interfaces.
|
27
|
-
|
28
|
-
`xknx <https://github.com/XKNX/xknx>`__ is a Python package you can use to talk to ``knxd``.
|
29
|
-
|
30
|
-
`moat.kv-knx <https://github.com/M-o-a-T/distknx>`__ connects values stored
|
31
|
-
in moat.kv to devices on the KNX bus.
|
32
|
-
|
33
|
-
|
34
|
-
1wire
|
35
|
-
=====
|
36
|
-
|
37
|
-
`1wire <https://en.wikipedia.org/wiki/1-Wire>`__ is a two- or three-wire
|
38
|
-
bus (one signal wire, somewhat-optional 5V power, ground) that is
|
39
|
-
frequently used to connect inexpensive sensors and actors to a computer.
|
40
|
-
|
41
|
-
`OWFS <https://www.owfs.org/>`__ is the server commonly used on Linux
|
42
|
-
systems to talk to 1wire.
|
43
|
-
|
44
|
-
`asyncowfs <https://github.com/M-o-a-T/asyncowfs>`__ is a Python package
|
45
|
-
that provides a high-level object-oriented async interface to OWFS.
|
46
|
-
|
47
|
-
`moat-kv-owfs <https://github.com/M-o-a-T/distknx>`__ uses ``asyncowfs`` to
|
48
|
-
connect values stored in ``moat.kv`` to attributes if 1wire devices.
|
49
|
-
|
50
|
-
|
51
|
-
Inventory Management
|
52
|
-
====================
|
53
|
-
|
54
|
-
`moat-kv-inv <https://github.com/M-o-a-T/moat-kv-inv>`__ is a command-line
|
55
|
-
extension that stores of hosts, networks and cables. It contains templating
|
56
|
-
code so you can auto-create the configuration for your router (if it's text
|
57
|
-
instead of some binary format).
|
58
|
-
|
59
|
-
|
60
|
-
Akumuli
|
61
|
-
=======
|
62
|
-
|
63
|
-
`Akumuli <https://akumuli.org/>`__ is a time series database.
|
64
|
-
|
65
|
-
`asyncakumuli <https://github.com/M-o-a-T/asyncakumuli>`__ is a Python package
|
66
|
-
that provides an async interface to Akumuli.
|
67
|
-
|
68
|
-
`moat.kv-akumuli <https://github.com/M-o-a-T/distakumuli>`__ implements a
|
69
|
-
background task that monitors values stored in ``moat.kv`` and mirrors them
|
70
|
-
into Akumuli, thus saving their history.
|
71
|
-
|
72
|
-
|
73
|
-
Binary I/O
|
74
|
-
==========
|
75
|
-
|
76
|
-
`asyncgpio <https://github.com/M-o-a-T/asyncgpio>`__ is a Python package
|
77
|
-
that provides structured access to your computer's I/O ports.
|
78
|
-
|
79
|
-
`moat.kv-gpio <https://github.com/M-o-a-T/distgpio>`__ contains code that
|
80
|
-
mirrors a binary value stored in ``moat.kv`` to a GPIO pin and vice versa.
|
81
|
-
|
82
|
-
|
83
|
-
Wago I/O controllers
|
84
|
-
====================
|
85
|
-
|
86
|
-
The German company `WAGO Kontakttechnik <https://www.wago.com>`__ makes the
|
87
|
-
``750-*`` line of extensible rugged controllers with various modules.
|
88
|
-
|
89
|
-
|