Commit 6e59f166 authored by Josh Kunz's avatar Josh Kunz

Switch client library to use new node_grant.rp0() method

parent 286accd4
......@@ -20,11 +20,11 @@ n1 = p.rp0().recv()
# Mint a copy of this node capability
n1_1 =
# Create a new rendezvous point
rp1 = p.create(RP)
# Reset the node, and set its rp0 to rp1
grant = n1.reset()
# Get the RP0 of the newly reset node
rp1 = grant.rp0()
# Send it a capability to itself
......@@ -672,16 +672,12 @@ class Node(Capability):
reply = self.protocol._invoke(self, cn_pb.CPOBJMETHOD_NODE_INFO, None)
return reply.item.node_info
def reset(self, rp):
"""Reset this node, and set its RP0 to the given RP.
def reset(self):
"""Reset this node.
Returns a node grant capability.
Returns a node grant capability for this node.
args = cn_pb.CPInvokeNodeResetArgs()
assert rp.__class__ == RP
args.rp_cptr = rp.cptr
reply = self.protocol._invoke(self, cn_pb.CPOBJMETHOD_NODE_RESET,
("node_reset_args", args))
reply = self.protocol._invoke(self, cn_pb.CPOBJMETHOD_NODE_RESET, None)
return reply.item.capability
# Exception raised when there is a protocol violation in the recv_iter protocol
......@@ -917,6 +913,15 @@ class NodeGrant(Capability):
("node_grant_grant_args", args))
assert reply.has_no_items
def rp0(self):
"""Get the RP0 of the node this grant was created from.
Returns a capability to the appropriate RP.
reply = self.protocol._invoke(self, cn_pb.CPOBJMETHOD_NODE_GRANT_RP0, None)
return reply.item.capability
def flow(self, *args):
"""Create a new flow for the node this node grant was obtained from
with the given restrictions.
......@@ -17,8 +17,8 @@ def recv_preamble(p):
def recv_nodes(p, rp_iter):
nodes = {}
for node in rp_iter:
node_rp = p.create(capnet.RP)
grant = node.reset(node_rp)
grant = node.reset()
node_rp = grant.rp0()
info =
flow = grant.flow()
nodes[] = NodeProperties(node, grant, info, node_rp, flow)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment