rename NameplateLister to Lister (unique prefix L)

This commit is contained in:
Brian Warner 2017-03-03 06:22:40 -08:00
parent e22657cf4b
commit b7b8df17be
10 changed files with 43 additions and 43 deletions

View File

@ -1,7 +1,7 @@
default: images
images: boss.png code.png key.png machines.png mailbox.png nameplate.png nameplate_lister.png order.png receive.png send.png terminator.png
images: boss.png code.png key.png machines.png mailbox.png nameplate.png lister.png order.png receive.png send.png terminator.png
.PHONY: default images

View File

@ -15,7 +15,7 @@ digraph {
S2 -> P2_completion [label="<tab>"]
P2_completion [shape="box" label="do completion"]
P2_completion -> P0_list_nameplates
P0_list_nameplates [shape="box" label="NL.refresh_nameplates"]
P0_list_nameplates [shape="box" label="L.refresh_nameplates"]
P0_list_nameplates -> S2
S2 -> P2_got_nameplates [label="got_nameplates"]

View File

@ -1,6 +1,6 @@
digraph {
{rank=same; title S0A S0B}
title [label="Nameplate\nLister" style="dotted"]
title [label="(Nameplate)\nLister" style="dotted"]
S0A [label="S0A:\nnot wanting\nunconnected"]
S0B [label="S0B:\nnot wanting\nconnected" color="orange"]
@ -38,5 +38,5 @@ digraph {
{rank=same; foo foo2 legend}
legend [shape="box" style="dotted"
label="refresh: NL.refresh_nameplates()\nrx: NL.rx_nameplates()"]
label="refresh: L.refresh_nameplates()\nrx: L.rx_nameplates()"]
}

View File

@ -12,8 +12,8 @@ digraph {
Send [shape="box" label="Send" color="blue" fontcolor="blue"]
Receive [shape="box" label="Receive" color="blue" fontcolor="blue"]
Code [shape="box" label="Code" color="blue" fontcolor="blue"]
NameplateLister [shape="box" label="Nameplate\nLister"
color="blue" fontcolor="blue"]
Lister [shape="box" label="(Nameplate)\nLister"
color="blue" fontcolor="blue"]
Terminator [shape="box" color="blue" fontcolor="blue"]
Connection -> websocket [color="blue"]
@ -58,12 +58,12 @@ digraph {
Connection -> Mailbox [style="dashed"
label="connected\nlost\nrx_message\nrx_closed\nstopped"]
Connection -> NameplateLister [style="dashed"
label="connected\nlost\nrx_nameplates"
]
NameplateLister -> Connection [style="dashed"
label="tx_list"
]
Connection -> Lister [style="dashed"
label="connected\nlost\nrx_nameplates"
]
Lister -> Connection [style="dashed"
label="tx_list"
]
#Boss -> Code [color="blue"]
Connection -> Code [style="dashed"
@ -71,13 +71,13 @@ digraph {
Code -> Connection [style="dashed"
label="tx_allocate"
]
NameplateLister -> Code [style="dashed"
label="got_nameplates"
]
#Code -> NameplateLister [color="blue"]
Code -> NameplateLister [style="dashed"
label="refresh_nameplates"
]
Lister -> Code [style="dashed"
label="got_nameplates"
]
#Code -> Lister [color="blue"]
Code -> Lister [style="dashed"
label="refresh_nameplates"
]
Boss -> Code [style="dashed"
label="allocate_code\ninput_code\nset_code_code"]
Code -> Boss [style="dashed"

View File

@ -14,7 +14,7 @@ from ._order import Order
from ._key import Key
from ._receive import Receive
from ._rendezvous import RendezvousConnector
from ._nameplate_lister import NameplateListing
from ._lister import Lister
from ._code import Code
from ._terminator import Terminator
from .errors import ServerError, LonelyError, WrongPasswordError
@ -44,7 +44,7 @@ class Boss(object):
self._RC = RendezvousConnector(self._url, self._appid, self._side,
self._reactor, self._journal,
self._timing)
self._NL = NameplateListing()
self._L = Lister()
self._C = Code(self._timing)
self._T = Terminator()
@ -54,9 +54,9 @@ class Boss(object):
self._O.wire(self._K, self._R)
self._K.wire(self, self._M, self._R)
self._R.wire(self, self._S)
self._RC.wire(self, self._N, self._M, self._C, self._NL, self._T)
self._NL.wire(self._RC, self._C)
self._C.wire(self, self._RC, self._NL)
self._RC.wire(self, self._N, self._M, self._C, self._L, self._T)
self._L.wire(self._RC, self._C)
self._C.wire(self, self._RC, self._L)
self._T.wire(self, self._RC, self._N, self._M)
self._next_tx_phase = 0
@ -72,7 +72,7 @@ class Boss(object):
def _set_trace(self, client_name, which, logger):
names = {"B": self, "N": self._N, "M": self._M, "S": self._S,
"O": self._O, "K": self._K, "R": self._R,
"RC": self._RC, "NL": self._NL, "C": self._C,
"RC": self._RC, "L": self._L, "C": self._C,
"T": self._T}
for machine in which.split():
def tracer(old_state, input, new_state, machine=machine):

View File

@ -28,10 +28,10 @@ class Code(object):
@m.setTrace()
def set_trace(): pass # pragma: no cover
def wire(self, boss, rendezvous_connector, nameplate_lister):
def wire(self, boss, rendezvous_connector, lister):
self._B = _interfaces.IBoss(boss)
self._RC = _interfaces.IRendezvousConnector(rendezvous_connector)
self._NL = _interfaces.INameplateLister(nameplate_lister)
self._L = _interfaces.ILister(lister)
@m.state(initial=True)
def S0_unknown(self): pass # pragma: no cover
@ -62,7 +62,7 @@ class Code(object):
@m.input()
def rx_allocated(self, nameplate): pass
# from NameplateLister
# from Lister
@m.input()
def got_nameplates(self, nameplates): pass
@ -75,12 +75,12 @@ class Code(object):
def RETURN(self, code): pass
@m.output()
def NL_refresh_nameplates(self):
self._NL.refresh_nameplates()
def L_refresh_nameplates(self):
self._L.refresh_nameplates()
@m.output()
def start_input_and_NL_refresh_nameplates(self, stdio):
def start_input_and_L_refresh_nameplates(self, stdio):
self._stdio = stdio
self._NL.refresh_nameplates()
self._L.refresh_nameplates()
@m.output()
def stash_code_length(self, code_length):
self._code_length = code_length
@ -124,7 +124,7 @@ class Code(object):
outputs=[generate_and_B_got_code])
S0_unknown.upon(input_code, enter=S2_typing_nameplate,
outputs=[start_input_and_NL_refresh_nameplates])
outputs=[start_input_and_L_refresh_nameplates])
S2_typing_nameplate.upon(tab, enter=S2_typing_nameplate,
outputs=[do_completion_nameplates])
S2_typing_nameplate.upon(got_nameplates, enter=S2_typing_nameplate,

View File

@ -18,7 +18,7 @@ class IReceive(Interface):
pass
class IRendezvousConnector(Interface):
pass
class INameplateLister(Interface):
class ILister(Interface):
pass
class ICode(Interface):
pass

View File

@ -3,8 +3,8 @@ from zope.interface import implementer
from automat import MethodicalMachine
from . import _interfaces
@implementer(_interfaces.INameplateLister)
class NameplateListing(object):
@implementer(_interfaces.ILister)
class Lister(object):
m = MethodicalMachine()
@m.setTrace()
def set_trace(): pass # pragma: no cover

View File

@ -91,12 +91,12 @@ class RendezvousConnector(object):
# TODO: Tor goes here
return endpoints.HostnameEndpoint(self._reactor, hostname, port)
def wire(self, boss, nameplate, mailbox, code, nameplate_lister, terminator):
def wire(self, boss, nameplate, mailbox, code, lister, terminator):
self._B = _interfaces.IBoss(boss)
self._N = _interfaces.INameplate(nameplate)
self._M = _interfaces.IMailbox(mailbox)
self._C = _interfaces.ICode(code)
self._NL = _interfaces.INameplateLister(nameplate_lister)
self._L = _interfaces.ILister(lister)
self._T = _interfaces.ITerminator(terminator)
# from Boss
@ -127,7 +127,7 @@ class RendezvousConnector(object):
d.addBoth(self._stopped)
# from NameplateLister
# from Lister
def tx_list(self):
self._tx("list")
@ -143,7 +143,7 @@ class RendezvousConnector(object):
self._C.connected()
self._N.connected()
self._M.connected()
self._NL.connected()
self._L.connected()
def ws_message(self, payload):
msg = bytes_to_dict(payload)
@ -177,7 +177,7 @@ class RendezvousConnector(object):
self._C.lost()
self._N.lost()
self._M.lost()
self._NL.lost()
self._L.lost()
# internal
def _stopped(self, res):
@ -210,7 +210,7 @@ class RendezvousConnector(object):
nameplate_id = n["id"]
assert isinstance(nameplate_id, type("")), type(nameplate_id)
nids.append(nameplate_id)
self._NL.rx_nameplates(nids)
self._L.rx_nameplates(nids)
def _response_handle_ack(self, msg):
pass

View File

@ -127,7 +127,7 @@ class _DeferredWormhole(object):
self._closed_observers.append(d)
return d
def debug_set_trace(self, client_name, which="B N M S O K R RC NL C T",
def debug_set_trace(self, client_name, which="B N M S O K R RC L C T",
logger=_log):
self._boss._set_trace(client_name, which, logger)