31.05.2013 Views

progettazione e realizzazione in java di una rete peer to peer ...

progettazione e realizzazione in java di una rete peer to peer ...

progettazione e realizzazione in java di una rete peer to peer ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appen<strong>di</strong>ce A<br />

Documentazione del proget<strong>to</strong><br />

A.1 Kademlia<br />

This document describes our Kademlia implementation. This client is <strong>in</strong>tended<br />

<strong>to</strong> run over a connectivity layer allow<strong>in</strong>g high scalability and high modularization.<br />

Byte arrays mov<strong>in</strong>g between the Kademlia layer and connectivity layer are mana-<br />

ged by a simple moni<strong>to</strong>r. Kademlia, as described <strong>in</strong> [1], uses four logic RPC and<br />

several ADT that s<strong>to</strong>re <strong>in</strong>formation about the net around a node. A description<br />

of the implementation of the four RPC follows. We expla<strong>in</strong> choices and policies<br />

and f<strong>in</strong>ally most important pieces of code.<br />

The ma<strong>in</strong> class of the package is KadAdt that provides all the primary low<br />

level methods <strong>to</strong> operate on the basic structure of Kademlia. Besides this object<br />

other threads ma<strong>in</strong>ta<strong>in</strong> data consistency and the node runn<strong>in</strong>g 1 .<br />

We analyze the whole package keep<strong>in</strong>g <strong>in</strong> m<strong>in</strong>d how it works, giv<strong>in</strong>g a tran-<br />

sversal view of the <strong>in</strong>volved classes.<br />

A.1.1 ADT<br />

In a Kademlia client there are three <strong>di</strong>fferent ma<strong>in</strong> data structures.<br />

1. the table of buckets;<br />

2. the table of random bytes;<br />

3. the table of s<strong>to</strong>re:<br />

• the table of <strong>in</strong>ternal s<strong>to</strong>re;<br />

• the table of external s<strong>to</strong>re.<br />

1 Accept<strong>in</strong>g new <strong>in</strong>com<strong>in</strong>g connection.<br />

39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!