Giter Site home page Giter Site logo

ndrsllwngr / hll-rust Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 576 KB

P2P application based on Chord algorithm (by MIT) in Rust. High-level languages: Rust - Group project (2018/2019)

Home Page: https://web.archive.org/web/20200219185836/https://www.pms.ifi.lmu.de/lehre/rust/18ws19/index.html

Rust 97.06% Shell 2.94%
chord-ring algorithm rust p2p-network

hll-rust's Introduction

hll-rust

High-level languages: Rust - Group project (2018/2019)

  • Chord is a protocol and algorithm for a peer-to-peer distributed hash table.

Table of Contents

Demonstration

In the following demo first ./target/debug/hll-rust 10.0.1.2 11111 was executed. Soon afterwards bash test.sh 10.0.1.2 10000 10 10.0.1.2:11111 was executed in another terminal. Take a look the terminal of the 11111 node.

demo

Installation

Run in the project folder cargo build.

Requirements

$ rustc --version
rustc 1.32.0 (9fda7c223 2019-01-16)
$ rustup --version
rustup 1.16.0 (beab5ac2b 2018-12-06)
$ cargo --version
cargo 1.32.0 (8610973aa 2019-01-02)

Usage

Important Disclaimer: When we speak of LocalIp4Addr in the following parts of the readme we mean the IPV4 Address you have in your local network (e.g. eduroam) not localhost, this can be found out by calling ifconfig in a terminal

Run a single node

To print our CLI help run which prints

$ cargo run -- -h

hll_rust_chord 1.0
Andreas Ellwanger, Timo Erdelt and Andreas Griesbeck
High level languages: Rust - Group project (2018/2019)

USAGE:
    hll-rust <IP4ADDR> <PORT> [IP4ADDR:PORT]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <IP4ADDR>         Sets the ip address to use (e.g. 127.0.0.1)
    <PORT>            Sets the port to use
    <IP4ADDR:PORT>    Sets the node (entry point to an existing chord ring) to join

To spawn a single node which creates a new chord ring run

cargo run -- <LocalIp4Addr> <LocalPort>

To spawn a single node and join an existing chord ring run

cargo run -- <LocalIp4Addr> <LocalPort> <OtherIp4Addr:OtherPort>

Open menu dialog

To open the menu while running a node type m and press ENTER which opens the following menu

Hello there! What do you want to do?

1 - Store a key/value pair in the Chord network
2 - Find the value for a given key in the Chord network
3 - Delete a key/value pair from the Chord network

4 - Kill a Chord network peer

5 - Cancel interaction
6 - Terminate Node

Choose 1, 2, 3, 4, 5 or 6 and press Enter!
  • To store a key and value within the chord ring press 1+ENTER and follow the instructions.
  • To find a value within the chord ring press 2+ENTER and follow the instructions.
  • To delete a key and value within the chord ring press 3+ENTER and follow the instructions.
  • To kill another chord ring peer press 4+ENTER and follow the instructions.
  • To close the menu press 5+ENTER.
  • To terminate the node press 6+ENTER.

Spawn multiple nodes at once

In order to spawn a new chord ring with a given number of nodes on a system we created a bash script which can be used as follows:

bash test.sh <LocalIp4Addr> <PortOfFirstNode> <NumberOfNodes>

In order to create a number of nodes and join them on an existing chord ring the same script can be used by applying an additional command line argument:

bash test.sh <LocalIp4Addr> <PortOfFirstNode> <NumberOfNodes> <IpOfJoinNode:Port>

Important notes

  • The script creates the nodes with ports starting at <PortOfFirstNode> and ending at <PortOfFirstNode+NumberOfNodes-1>
  • Unfortunately the menu for interacting with the chord ring (e.g story, querying, deleting from DHT) does not work with the node being rendered after the script has completed. In order to get the menu a new node has to be spawned in another terminal with one of the IP addresses of the just spawned ring as the join IP.
  • We have not tested the script big number of nodes, we usually ran it with 10 nodes which did produce no problems, but it should theoretically also work for a bigger amounts, but we sometimes ran into problems running more nodes on a single machine

Crates

chrono, clap, colored, futures, get_if_addrs, log, log4rs, num,
num-bigint, prettytable-rs, rust-crypto, serde, serde_derive,
serde_json, signal-hook, tokio

For more details take a look at the Cargo.toml.

Chord

Take a look at our chord description or our references.

References

Contributors (Group E)

  • Andreas Ellwanger
  • Timo Erdelt
  • Andreas Griesbeck

Individual contributions

Due too the small group size of 3 it is impossible for us to properly distinguish what of our project has been done by whom. We all worked on all parts of our application, especially since we mostly did “pair-programming” (with two or often all three of us working together). So all of us were equally involved in all parts of our application, namely networking (TCP sockets, Tokio), threading, algorithm & communication protocol, user interaction through the command line interface & bash scripts. We would be happy to answer questions about our development process, aswell as our individual/colletive contributions at the examination.

hll-rust's People

Contributors

griase94 avatar ndrsllwngr avatar tmrdlt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hll-rust's Issues

Concurrent node implementation

Node must be able to run an infinite loop and edit its' attributes, as well as concurrently process incoming messages which may edit its' attributes, too.

Initialise FingerTable correctly

Check what length of FingerTable should have, set it to that size, initialise with reasonable values
Read README and references to correctly init FingerTable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.