mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
rename all "*PBURL*" to "*FURL*"
This breaks backwards compatibility with Tahoe v0.2 -- the first public release of Tahoe.
This commit is contained in:
parent
9cd1757799
commit
3872e94da2
@ -41,7 +41,7 @@ The node then constructs a reservation message that contains enough
|
|||||||
information for the potential landlord to evaluate the lease, *and* to make a
|
information for the potential landlord to evaluate the lease, *and* to make a
|
||||||
connection back to the starting node:
|
connection back to the starting node:
|
||||||
|
|
||||||
message = [verifierid, sharesize, requestor_pburl, starting_points]
|
message = [verifierid, sharesize, requestor_furl, starting_points]
|
||||||
|
|
||||||
The node looks through its list of finger connections and splits this message
|
The node looks through its list of finger connections and splits this message
|
||||||
into up to log2(N) smaller messages, each of which contains only the starting
|
into up to log2(N) smaller messages, each of which contains only the starting
|
||||||
@ -59,7 +59,7 @@ switches from the "hop" mode (following fingers) to the "search" mode
|
|||||||
|
|
||||||
While in "search" mode, each node interprets the message as a lease request.
|
While in "search" mode, each node interprets the message as a lease request.
|
||||||
It checks its storage pool to see if it can accomodate the reservation. If
|
It checks its storage pool to see if it can accomodate the reservation. If
|
||||||
so, it uses requestor_pburl to contact the originator and announces its
|
so, it uses requestor_furl to contact the originator and announces its
|
||||||
willingness to host the given sharenum. This message will include the
|
willingness to host the given sharenum. This message will include the
|
||||||
reliability measurement derived from the host's counterclockwise neighbors.
|
reliability measurement derived from the host's counterclockwise neighbors.
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ I visualize the peer-lookup process as the originator creating a
|
|||||||
message-in-a-bottle for each share. Each message says "Dear Sir/Madam, I
|
message-in-a-bottle for each share. Each message says "Dear Sir/Madam, I
|
||||||
would like to store X bytes of data for file Y (share #Z) on a system close
|
would like to store X bytes of data for file Y (share #Z) on a system close
|
||||||
to (but not below) nodeid STARTING_POINT. If you find this amenable, please
|
to (but not below) nodeid STARTING_POINT. If you find this amenable, please
|
||||||
contact me at PBURL so we can make arrangements.". These messages are then
|
contact me at FURL so we can make arrangements.". These messages are then
|
||||||
bundled together according to their rough destination (STARTING_POINT) and
|
bundled together according to their rough destination (STARTING_POINT) and
|
||||||
sent somewhere in the right direction.
|
sent somewhere in the right direction.
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class Client(node.Node, Referenceable):
|
|||||||
|
|
||||||
def __init__(self, basedir="."):
|
def __init__(self, basedir="."):
|
||||||
node.Node.__init__(self, basedir)
|
node.Node.__init__(self, basedir)
|
||||||
self.my_pburl = None
|
self.my_furl = None
|
||||||
self.introducer_client = None
|
self.introducer_client = None
|
||||||
self.connected_to_vdrive = False
|
self.connected_to_vdrive = False
|
||||||
self.add_service(StorageServer(os.path.join(basedir, self.STOREDIR)))
|
self.add_service(StorageServer(os.path.join(basedir, self.STOREDIR)))
|
||||||
@ -60,9 +60,9 @@ class Client(node.Node, Referenceable):
|
|||||||
|
|
||||||
def tub_ready(self):
|
def tub_ready(self):
|
||||||
self.log("tub_ready")
|
self.log("tub_ready")
|
||||||
self.my_pburl = self.tub.registerReference(self)
|
self.my_furl = self.tub.registerReference(self)
|
||||||
|
|
||||||
ic = IntroducerClient(self.tub, self.introducer_furl, self.my_pburl)
|
ic = IntroducerClient(self.tub, self.introducer_furl, self.my_furl)
|
||||||
self.introducer_client = ic
|
self.introducer_client = ic
|
||||||
ic.setServiceParent(self)
|
ic.setServiceParent(self)
|
||||||
|
|
||||||
@ -75,10 +75,10 @@ class Client(node.Node, Referenceable):
|
|||||||
c = ControlServer()
|
c = ControlServer()
|
||||||
c.setServiceParent(self)
|
c.setServiceParent(self)
|
||||||
control_url = self.tub.registerReference(c)
|
control_url = self.tub.registerReference(c)
|
||||||
f = open("control.pburl", "w")
|
f = open("control.furl", "w")
|
||||||
f.write(control_url + "\n")
|
f.write(control_url + "\n")
|
||||||
f.close()
|
f.close()
|
||||||
os.chmod("control.pburl", 0600)
|
os.chmod("control.furl", 0600)
|
||||||
|
|
||||||
def _got_vdrive(self, vdrive_root):
|
def _got_vdrive(self, vdrive_root):
|
||||||
# vdrive_root implements RIMutableDirectoryNode
|
# vdrive_root implements RIMutableDirectoryNode
|
||||||
|
@ -10,18 +10,18 @@ Hash = StringConstraint(maxLength=HASH_SIZE,
|
|||||||
minLength=HASH_SIZE)# binary format 32-byte SHA256 hash
|
minLength=HASH_SIZE)# binary format 32-byte SHA256 hash
|
||||||
Nodeid = StringConstraint(maxLength=20,
|
Nodeid = StringConstraint(maxLength=20,
|
||||||
minLength=20) # binary format 20-byte SHA1 hash
|
minLength=20) # binary format 20-byte SHA1 hash
|
||||||
PBURL = StringConstraint(1000)
|
FURL = StringConstraint(1000)
|
||||||
Verifierid = StringConstraint(20)
|
Verifierid = StringConstraint(20)
|
||||||
URI = StringConstraint(300) # kind of arbitrary
|
URI = StringConstraint(300) # kind of arbitrary
|
||||||
MAX_BUCKETS = 200 # per peer
|
MAX_BUCKETS = 200 # per peer
|
||||||
ShareData = StringConstraint(100000)
|
ShareData = StringConstraint(100000)
|
||||||
|
|
||||||
class RIIntroducerClient(RemoteInterface):
|
class RIIntroducerClient(RemoteInterface):
|
||||||
def new_peers(pburls=SetOf(PBURL)):
|
def new_peers(furls=SetOf(FURL)):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
class RIIntroducer(RemoteInterface):
|
class RIIntroducer(RemoteInterface):
|
||||||
def hello(node=RIIntroducerClient, pburl=PBURL):
|
def hello(node=RIIntroducerClient, furl=FURL):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
class RIClient(RemoteInterface):
|
class RIClient(RemoteInterface):
|
||||||
|
@ -13,45 +13,45 @@ class Introducer(service.MultiService, Referenceable):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
service.MultiService.__init__(self)
|
service.MultiService.__init__(self)
|
||||||
self.nodes = set()
|
self.nodes = set()
|
||||||
self.pburls = set()
|
self.furls = set()
|
||||||
|
|
||||||
def remote_hello(self, node, pburl):
|
def remote_hello(self, node, furl):
|
||||||
log.msg("introducer: new contact at %s, node is %s" % (pburl, node))
|
log.msg("introducer: new contact at %s, node is %s" % (furl, node))
|
||||||
def _remove():
|
def _remove():
|
||||||
log.msg(" introducer: removing %s %s" % (node, pburl))
|
log.msg(" introducer: removing %s %s" % (node, furl))
|
||||||
self.nodes.remove(node)
|
self.nodes.remove(node)
|
||||||
self.pburls.remove(pburl)
|
self.furls.remove(furl)
|
||||||
node.notifyOnDisconnect(_remove)
|
node.notifyOnDisconnect(_remove)
|
||||||
self.pburls.add(pburl)
|
self.furls.add(furl)
|
||||||
node.callRemote("new_peers", self.pburls)
|
node.callRemote("new_peers", self.furls)
|
||||||
for othernode in self.nodes:
|
for othernode in self.nodes:
|
||||||
othernode.callRemote("new_peers", set([pburl]))
|
othernode.callRemote("new_peers", set([furl]))
|
||||||
self.nodes.add(node)
|
self.nodes.add(node)
|
||||||
|
|
||||||
|
|
||||||
class IntroducerClient(service.Service, Referenceable):
|
class IntroducerClient(service.Service, Referenceable):
|
||||||
implements(RIIntroducerClient)
|
implements(RIIntroducerClient)
|
||||||
|
|
||||||
def __init__(self, tub, introducer_pburl, my_pburl):
|
def __init__(self, tub, introducer_furl, my_furl):
|
||||||
self.tub = tub
|
self.tub = tub
|
||||||
self.introducer_pburl = introducer_pburl
|
self.introducer_furl = introducer_furl
|
||||||
self.my_pburl = my_pburl
|
self.my_furl = my_furl
|
||||||
|
|
||||||
self.connections = {} # k: nodeid, v: ref
|
self.connections = {} # k: nodeid, v: ref
|
||||||
self.reconnectors = {} # k: PBURL, v: reconnector
|
self.reconnectors = {} # k: FURL, v: reconnector
|
||||||
|
|
||||||
self.connection_observers = observer.ObserverList()
|
self.connection_observers = observer.ObserverList()
|
||||||
|
|
||||||
def startService(self):
|
def startService(self):
|
||||||
self.introducer_reconnector = self.tub.connectTo(self.introducer_pburl,
|
self.introducer_reconnector = self.tub.connectTo(self.introducer_furl,
|
||||||
self._got_introducer)
|
self._got_introducer)
|
||||||
|
|
||||||
def log(self, msg):
|
def log(self, msg):
|
||||||
self.parent.log(msg)
|
self.parent.log(msg)
|
||||||
|
|
||||||
def remote_new_peers(self, pburls):
|
def remote_new_peers(self, furls):
|
||||||
for pburl in pburls:
|
for furl in furls:
|
||||||
self._new_peer(pburl)
|
self._new_peer(furl)
|
||||||
|
|
||||||
def stopService(self):
|
def stopService(self):
|
||||||
service.Service.stopService(self)
|
service.Service.stopService(self)
|
||||||
@ -59,19 +59,19 @@ class IntroducerClient(service.Service, Referenceable):
|
|||||||
for reconnector in self.reconnectors.itervalues():
|
for reconnector in self.reconnectors.itervalues():
|
||||||
reconnector.stopConnecting()
|
reconnector.stopConnecting()
|
||||||
|
|
||||||
def _new_peer(self, pburl):
|
def _new_peer(self, furl):
|
||||||
if pburl in self.reconnectors:
|
if furl in self.reconnectors:
|
||||||
return
|
return
|
||||||
# TODO: rather than using the TubID as a nodeid, we should use
|
# TODO: rather than using the TubID as a nodeid, we should use
|
||||||
# something else. The thing that requires the least additional
|
# something else. The thing that requires the least additional
|
||||||
# mappings is to use the foolscap "identifier" (the last component of
|
# mappings is to use the foolscap "identifier" (the last component of
|
||||||
# the pburl), since these are unguessable. Before we can do that,
|
# the furl), since these are unguessable. Before we can do that,
|
||||||
# though, we need a way to conveniently make these identifiers
|
# though, we need a way to conveniently make these identifiers
|
||||||
# persist from one run of the client program to the next. Also, using
|
# persist from one run of the client program to the next. Also, using
|
||||||
# the foolscap identifier would mean that anyone who knows the name
|
# the foolscap identifier would mean that anyone who knows the name
|
||||||
# of the node also has all the secrets they need to contact and use
|
# of the node also has all the secrets they need to contact and use
|
||||||
# them, which may or may not be what we want.
|
# them, which may or may not be what we want.
|
||||||
m = re.match(r'pb://(\w+)@', pburl)
|
m = re.match(r'pb://(\w+)@', furl)
|
||||||
assert m
|
assert m
|
||||||
nodeid = idlib.a2b(m.group(1))
|
nodeid = idlib.a2b(m.group(1))
|
||||||
def _got_peer(rref):
|
def _got_peer(rref):
|
||||||
@ -83,14 +83,14 @@ class IntroducerClient(service.Service, Referenceable):
|
|||||||
# not. Could this cause a problem?
|
# not. Could this cause a problem?
|
||||||
del self.connections[nodeid]
|
del self.connections[nodeid]
|
||||||
rref.notifyOnDisconnect(_lost)
|
rref.notifyOnDisconnect(_lost)
|
||||||
self.log(" connecting to(%s)" % pburl)
|
self.log(" connecting to(%s)" % furl)
|
||||||
self.reconnectors[pburl] = self.tub.connectTo(pburl, _got_peer)
|
self.reconnectors[furl] = self.tub.connectTo(furl, _got_peer)
|
||||||
|
|
||||||
def _got_introducer(self, introducer):
|
def _got_introducer(self, introducer):
|
||||||
self.log(" introducing ourselves: %s, %s" % (self, self.my_pburl))
|
self.log(" introducing ourselves: %s, %s" % (self, self.my_furl))
|
||||||
d = introducer.callRemote("hello",
|
d = introducer.callRemote("hello",
|
||||||
node=self,
|
node=self,
|
||||||
pburl=self.my_pburl)
|
furl=self.my_furl)
|
||||||
|
|
||||||
def notify_on_new_connection(self, cb):
|
def notify_on_new_connection(self, cb):
|
||||||
"""Register a callback that will be fired (with nodeid, rref) when
|
"""Register a callback that will be fired (with nodeid, rref) when
|
||||||
|
@ -45,7 +45,7 @@ class TestIntroducer(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
ic = IntroducerClient(None, "introducer", "mypburl")
|
ic = IntroducerClient(None, "introducer", "myfurl")
|
||||||
def _ignore(nodeid, rref):
|
def _ignore(nodeid, rref):
|
||||||
pass
|
pass
|
||||||
ic.notify_on_new_connection(_ignore)
|
ic.notify_on_new_connection(_ignore)
|
||||||
@ -89,8 +89,8 @@ class TestIntroducer(unittest.TestCase):
|
|||||||
tub.setLocation("localhost:%d" % portnum)
|
tub.setLocation("localhost:%d" % portnum)
|
||||||
|
|
||||||
n = MyNode()
|
n = MyNode()
|
||||||
node_pburl = tub.registerReference(n)
|
node_furl = tub.registerReference(n)
|
||||||
c = IntroducerClient(tub, iurl, node_pburl)
|
c = IntroducerClient(tub, iurl, node_furl)
|
||||||
c.notify_on_new_connection(_count)
|
c.notify_on_new_connection(_count)
|
||||||
c.setServiceParent(self.parent)
|
c.setServiceParent(self.parent)
|
||||||
clients.append(c)
|
clients.append(c)
|
||||||
@ -167,8 +167,8 @@ class TestIntroducer(unittest.TestCase):
|
|||||||
clients = []
|
clients = []
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
n = MyNode()
|
n = MyNode()
|
||||||
node_pburl = tub.registerReference(n)
|
node_furl = tub.registerReference(n)
|
||||||
c = IntroducerClient(tub, iurl, node_pburl)
|
c = IntroducerClient(tub, iurl, node_furl)
|
||||||
c.setServiceParent(self.parent)
|
c.setServiceParent(self.parent)
|
||||||
clients.append(c)
|
clients.append(c)
|
||||||
|
|
||||||
@ -208,8 +208,8 @@ class TestIntroducer(unittest.TestCase):
|
|||||||
tub.setLocation("localhost:%d" % portnum)
|
tub.setLocation("localhost:%d" % portnum)
|
||||||
|
|
||||||
n = MyNode()
|
n = MyNode()
|
||||||
node_pburl = tub.registerReference(n)
|
node_furl = tub.registerReference(n)
|
||||||
c = IntroducerClient(tub, iurl, node_pburl)
|
c = IntroducerClient(tub, iurl, node_furl)
|
||||||
c.setServiceParent(self.parent)
|
c.setServiceParent(self.parent)
|
||||||
clients.append(c)
|
clients.append(c)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<h2>Grid Status</h2>
|
<h2>Grid Status</h2>
|
||||||
|
|
||||||
<div>My nodeid: <span n:render="string" n:data="my_nodeid" /></div>
|
<div>My nodeid: <span n:render="string" n:data="my_nodeid" /></div>
|
||||||
<div>Introducer: <span n:render="string" n:data="introducer_pburl" /></div>
|
<div>Introducer: <span n:render="string" n:data="introducer_furl" /></div>
|
||||||
<div>Connected to introducer?: <span n:render="string" n:data="connected_to_introducer" /></div>
|
<div>Connected to introducer?: <span n:render="string" n:data="connected_to_introducer" /></div>
|
||||||
<div>Known+Connected Peers: <span n:render="string" n:data="num_peers" /></div>
|
<div>Known+Connected Peers: <span n:render="string" n:data="num_peers" /></div>
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class Welcome(rend.Page):
|
|||||||
|
|
||||||
def data_my_nodeid(self, ctx, data):
|
def data_my_nodeid(self, ctx, data):
|
||||||
return idlib.b2a(IClient(ctx).nodeid)
|
return idlib.b2a(IClient(ctx).nodeid)
|
||||||
def data_introducer_pburl(self, ctx, data):
|
def data_introducer_furl(self, ctx, data):
|
||||||
return IClient(ctx).introducer_furl
|
return IClient(ctx).introducer_furl
|
||||||
def data_connected_to_introducer(self, ctx, data):
|
def data_connected_to_introducer(self, ctx, data):
|
||||||
if IClient(ctx).connected_to_vdrive:
|
if IClient(ctx).connected_to_vdrive:
|
||||||
|
Loading…
Reference in New Issue
Block a user