update to match new (private) Automat tracing API
This commit is contained in:
parent
c2a71e7240
commit
e6b9cf18be
|
@ -10,7 +10,7 @@ from . import _interfaces
|
||||||
class Allocator(object):
|
class Allocator(object):
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def wire(self, rendezvous_connector, code):
|
def wire(self, rendezvous_connector, code):
|
||||||
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
|
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Boss(object):
|
||||||
_tor_manager = attrib() # TODO: ITorManager or None
|
_tor_manager = attrib() # TODO: ITorManager or None
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._build_workers()
|
self._build_workers()
|
||||||
|
@ -92,8 +92,7 @@ class Boss(object):
|
||||||
"RC": self._RC, "L": self._L, "C": self._C,
|
"RC": self._RC, "L": self._L, "C": self._C,
|
||||||
"T": self._T}
|
"T": self._T}
|
||||||
for machine in which.split():
|
for machine in which.split():
|
||||||
def tracer(old_state, input, new_state, output, machine=machine):
|
def tracer(old_state, input, new_state, machine=machine):
|
||||||
if output is None:
|
|
||||||
if new_state:
|
if new_state:
|
||||||
print("%s.%s[%s].%s -> [%s]" %
|
print("%s.%s[%s].%s -> [%s]" %
|
||||||
(client_name, machine, old_state, input,
|
(client_name, machine, old_state, input,
|
||||||
|
@ -106,11 +105,12 @@ class Boss(object):
|
||||||
# phase), R.lost .
|
# phase), R.lost .
|
||||||
print("%s.%s.%s" % (client_name, machine, input),
|
print("%s.%s.%s" % (client_name, machine, input),
|
||||||
file=file)
|
file=file)
|
||||||
else:
|
file.flush()
|
||||||
if new_state:
|
def output_tracer(output):
|
||||||
print(" %s.%s.%s()" % (client_name, machine, output),
|
print(" %s.%s.%s()" % (client_name, machine, output),
|
||||||
file=file)
|
file=file)
|
||||||
file.flush()
|
file.flush()
|
||||||
|
return output_tracer
|
||||||
names[machine].set_trace(tracer)
|
names[machine].set_trace(tracer)
|
||||||
|
|
||||||
## def serialize(self):
|
## def serialize(self):
|
||||||
|
|
|
@ -13,7 +13,7 @@ def first(outputs):
|
||||||
class Code(object):
|
class Code(object):
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def wire(self, boss, allocator, nameplate, key, input):
|
def wire(self, boss, allocator, nameplate, key, input):
|
||||||
self._B = _interfaces.IBoss(boss)
|
self._B = _interfaces.IBoss(boss)
|
||||||
|
|
|
@ -14,7 +14,7 @@ def first(outputs):
|
||||||
class Input(object):
|
class Input(object):
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._all_nameplates = set()
|
self._all_nameplates = set()
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Key(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._SK = _SortedKey(self._appid, self._versions, self._side,
|
self._SK = _SortedKey(self._appid, self._versions, self._side,
|
||||||
|
@ -115,7 +115,7 @@ class _SortedKey(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def wire(self, boss, mailbox, receive):
|
def wire(self, boss, mailbox, receive):
|
||||||
self._B = _interfaces.IBoss(boss)
|
self._B = _interfaces.IBoss(boss)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from . import _interfaces
|
||||||
class Lister(object):
|
class Lister(object):
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def wire(self, rendezvous_connector, input):
|
def wire(self, rendezvous_connector, input):
|
||||||
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
|
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from . import _interfaces
|
||||||
class Mailbox(object):
|
class Mailbox(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._mailbox = None
|
self._mailbox = None
|
||||||
|
|
|
@ -7,7 +7,7 @@ from ._wordlist import PGPWordList
|
||||||
@implementer(_interfaces.INameplate)
|
@implementer(_interfaces.INameplate)
|
||||||
class Nameplate(object):
|
class Nameplate(object):
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._nameplate = None
|
self._nameplate = None
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Order(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._key = None
|
self._key = None
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Receive(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._key = None
|
self._key = None
|
||||||
|
|
|
@ -83,7 +83,7 @@ class RendezvousConnector(object):
|
||||||
self._trace = f
|
self._trace = f
|
||||||
def _debug(self, what):
|
def _debug(self, what):
|
||||||
if self._trace:
|
if self._trace:
|
||||||
self._trace(old_state="", input=what, new_state="", output=None)
|
self._trace(old_state="", input=what, new_state="")
|
||||||
|
|
||||||
def _make_endpoint(self, hostname, port):
|
def _make_endpoint(self, hostname, port):
|
||||||
if self._tor_manager:
|
if self._tor_manager:
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Send(object):
|
||||||
_side = attrib(validator=instance_of(type(u"")))
|
_side = attrib(validator=instance_of(type(u"")))
|
||||||
_timing = attrib(validator=provides(_interfaces.ITiming))
|
_timing = attrib(validator=provides(_interfaces.ITiming))
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __attrs_post_init__(self):
|
def __attrs_post_init__(self):
|
||||||
self._queue = []
|
self._queue = []
|
||||||
|
|
|
@ -6,7 +6,7 @@ from . import _interfaces
|
||||||
@implementer(_interfaces.ITerminator)
|
@implementer(_interfaces.ITerminator)
|
||||||
class Terminator(object):
|
class Terminator(object):
|
||||||
m = MethodicalMachine()
|
m = MethodicalMachine()
|
||||||
set_trace = getattr(m, "setTrace", lambda self, f: None)
|
set_trace = getattr(m, "_setTrace", lambda self, f: None)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._mood = None
|
self._mood = None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user