The Distributed Storage layer

The Chord protocol is implemented in class ChordNodeImpl derived from interface ChordNode, both in package edu.it.xmlstore.chord. This class contains the basic Chord functionality such as joining and leaving a Chord ring, and looking up a node responsible for an identifier.

Distributed storage layer

The Chord identifiers are represented by classes ChordId and ChordIdImpl. These classes encapsulate the handling of 160-bit integers and makes sure that all arithmetic is modulo 2^160. Value references and Chord identifiers are almost alike, but we nevertheless have different interfaces for them, though both interfaces are implemented by the same class. This is due to some subtle differences: A value reference only needs to be checked for equality, whereas a Chord identifier needs to be able to handle arithmetic with other Chord identifiers as well as more detailed comparison operators. The ChordId interface is used instead of value references in the Distributed Storage layer.

The class ChordNodeImpl contains only the functionality required for handling joining, leaving and looking up a node given an id. The XmlStoreServerImpl extends ChordNodeImpl, gaining access to the routing algorithms and supplying such functionality as storage of values. Where needed, e.g. when joining and leaving, XmlStoreServerImpl overrides the original methods to add special behaviour. Other applications wishing to use the Chord routing algorithm can likewise extend class ChordNodeImpl.