Figure 7.42. Pastry Endpoint API
interface Node { Endpoint registerApplication (Application application, java.lang.String instance); ... } interface Endpoint { Id getId (); // Get a list of nodes that can route towards a node NodeHandleSet localLookup (Id id, int num, boolean safe); // Get the list of neighbor nodes NodeHandleSet neighborSet (int num); // Get the range of keys we are responsible for IdRange range (NodeHandle handle, int rank, Id lkey); // Get a list of nodes that can store a replica NodeHandleSet replicaSet (Id id, int maxRank); // Send a message to a node void route (Id id, Message message, NodeHandle hint); ... }
Figure 7.43. Pastry Application API
interface Application { void deliver (Id id, Message message); boolean forward (RouteMessage message); void update (NodeHandle handle, boolean joined); }
References.Â
Antony Rowstron, Peter Druschel: Pastry: Scalable, Decentralized Object Location and Routing for Large-Scale Peer-to-Peer Systems.