Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Implement id space computation #8

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft

Implement id space computation #8

wants to merge 18 commits into from

Conversation

cache-nez
Copy link
Collaborator

To be merged after resilient routing

This commit introduces the following changes:

* defines a Router (implementing dela's router.Router). It contains no routing
  information. Its methods GenerateTableFrom(handshake) and New(players, thisAddress)
  call NewTable(addresses, thisId), which constructs the routing table from the
  addresses of other participating nodes and the id of the current node.

* implements NewTable. This function traverses shuffled addresses and if the
  prefix of the given address does not appear in the routing table yet, this
  address becomes the next hope for this prefix.

* sketches the routing. In this prototype, RoutingTable.Forward simply chooses
  the next hop from the routing table (it assumes the next hop is always in the
  table). OnFailure does nothing.
A node can receive multiple handshakes and we shouldn't recompute the routing
table on each handshake. To keep the first computed routing table:
* Change all router's methods to have a pointer receiver
* Store the routing table in the router when it's first computed
* If a routing table is already computed when a node receives a handshake,
  do not recompute the table
…uting table.

When the node, booting the protocol, calls `Router:New` to create a routing table,
the node's address is not included in the set of players' addresses, passed to the
method. However, the node *is* a player and should be included in the routing.

This is enough to make all other players aware of this node, because the same array
of addresses, where the booting node is now included, is passed in a handshake
to any new node.
the destination address is not equal to this node's address.

This is a hack to accommodate for minogrpc's design, where the only way to reach
the client side of the orchestrator is routing a message to nil from the server
side of the orchestrator.
When routing to a next hop fails, pick an alternative among nodes, routing to which
hasn't failed before: either another node with longer common (with destination)
prefix than this node's or a node with the same common prefix, but numerically
closer to destination. If routing to all suitable nodes failed, return a Void.
OnFailure is invoked to signal that a chosen next hop is unreachable. Simply
mark it as such without eagerly computing an alternative. When Forward is invoked
and the next hop in the routing table is unreachable, compute the alternative.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant