etcd: Rewrite embed etcd implementation

This is a giant cleanup of the etcd code. The earlier version was
written when I was less experienced with golang.

This is still not perfect, and does contain some races, but at least
it's a decent base to start from. The automatic elastic clustering
should be considered an experimental feature. If you need a more
battle-tested cluster, then you should manage etcd manually and point
mgmt at your existing cluster.
This commit is contained in:
James Shubin
2018-05-05 17:35:08 -04:00
parent fb275d9537
commit a5842a41b2
56 changed files with 5459 additions and 2654 deletions

View File

@@ -23,17 +23,25 @@
import sys
lines = sys.stdin.readlines()
if len(sys.argv) == 2 and sys.argv[1] != "-":
lines = open(sys.argv[1], "r").readlines()
else:
lines = sys.stdin.readlines()
print("read: %d lines" % len(lines))
# find program start
start = -1
for i in range(len(lines)):
line = lines[i]
if line.startswith("PC="):
start=i
break
if start == -1:
print("could not find program start, looking for PC=???", file=sys.stderr)
sys.exit(1)
print("starts at line: %d" % (start+1)) # +1 because we're zero based
def is_chunk(line):
@@ -59,6 +67,18 @@ def filter_chunk(chunk):
package_line = lines[1]
if package_line.startswith("github.com/purpleidea/mgmt/vendor/"):
return False
if package_line.startswith("github.com/") and not package_line.startswith("github.com/purpleidea/mgmt/"):
return False
if package_line.startswith("internal/poll"):
return False
if package_line.startswith("context.propagateCancel"):
return False
if package_line.startswith("runtime.gopark"):
return False
if package_line.startswith("runtime.futex"):
return False
if package_line.startswith("os/signal.signal_recv"):
return False
return True