{"id":28066707,"url":"https://github.com/shojiyao12/basic_chord-dfs","last_synced_at":"2025-05-12T15:52:15.116Z","repository":{"id":292845032,"uuid":"982123712","full_name":"Shojiyao12/Basic_Chord-DFS","owner":"Shojiyao12","description":"This project implements a decentralized file storage system using the Chord Distributed Hash Table (DHT) protocol. It enables efficient file storage, retrieval, and lookup across multiple nodes in a peer-to-peer network. ","archived":false,"fork":false,"pushed_at":"2025-05-12T12:14:14.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T13:26:50.313Z","etag":null,"topics":["chords","decentralized-file-storage","distributed-hash-table","distributed-systems","fault-tolerance","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shojiyao12.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-12T12:09:54.000Z","updated_at":"2025-05-12T12:17:00.000Z","dependencies_parsed_at":"2025-05-12T13:37:00.992Z","dependency_job_id":null,"html_url":"https://github.com/Shojiyao12/Basic_Chord-DFS","commit_stats":null,"previous_names":["shojiyao12/basic_chord-dfs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shojiyao12%2FBasic_Chord-DFS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shojiyao12%2FBasic_Chord-DFS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shojiyao12%2FBasic_Chord-DFS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shojiyao12%2FBasic_Chord-DFS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shojiyao12","download_url":"https://codeload.github.com/Shojiyao12/Basic_Chord-DFS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253768991,"owners_count":21961459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chords","decentralized-file-storage","distributed-hash-table","distributed-systems","fault-tolerance","python"],"created_at":"2025-05-12T15:52:13.838Z","updated_at":"2025-05-12T15:52:15.103Z","avatar_url":"https://github.com/Shojiyao12.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chord-Based Distributed File System\n\nWelcome to the **Chord-Based Distributed File System**! This project implements a distributed hash table (DHT) using the Chord protocol, enabling efficient file storage and retrieval in a decentralized network.\n\n---\n\n## 🚀 Features\n\n- **Decentralized File Storage**: Store and retrieve files across a distributed network of nodes.\n- **Fault Tolerance**: Nodes can join and leave the network gracefully without disrupting the system.\n- **Efficient Lookup**: Uses the Chord protocol for fast and scalable file lookups.\n- **Command-Line Interface (CLI)**: Interact with the system using an intuitive CLI.\n- **File Upload and Retrieval**: Upload files to the network and retrieve them from any node.\n- **File Opening**: Open files directly from the network, even if they are stored on remote nodes.\n\n---\n\n## 📂 Project Structure\n\n```\n├── chord.py          # Main implementation of the Chord protocol\n\n├── utils.py          # Utility functions for hashing, IP retrieval, etc.\n\n├── test.txt          # Sample file for testing\n\n├── README.md         # Documentation for the project\n```\n\n---\n\n## 🛠️ Prerequisites\n\nBefore running the program, ensure you have the following installed:\n\n1. **Python 3.8+**: [Download Python](https://www.python.org/downloads/)\n2. **Required Libraries**: Install dependencies using `pip`:\n   \n   ```bash\n   pip install colorama\n   ```\n\n---\n\n## ▶️ How to Run the Program\n\n### Step 1: Clone or Extract the Repository\n\n- **From GitHub**: Clone the repository:\n  \n  ```bash\n  git clone https://github.com/Mvzvrt/Chord-DFS.git\n  cd Chord-DFS\n  ```\n- **From ZIP File**: Extract the ZIP file and navigate to the extracted folder.\n\n---\n\n### Step 2: Start a Node\n\n1. Open a terminal (Command Prompt or Terminal).\n2. Navigate to the project directory where `chord.py` is located.\n3. Run the following command to start a node:\n   \n   ```bash\n   python chord.py\n   ```\n4. Follow the prompts:\n   - **Enter the number of bits for the identifier space (m)**: Choose a value between 1 and 32 (e.g., `3`).\n\n   - **Enter Port**: Specify a port number for the node (e.g., `5000`).\n\n   - **Enter known node IP**: If this is the first node, press Enter. Otherwise, provide the IP of an existing node.\n\n   - **Enter known node Port**: If you entered an IP, provide the port of the known node.\n\n---\n\n### Step 3: Interact with the CLI\n\nOnce the node starts, you'll see the **Chord CLI**. Use the following commands to interact with the system:\n\n| Command       | Description                                                                 |\n|---------------|-----------------------------------------------------------------------------|\n| `help`        | Display a list of available commands.                                      |\n| `ft`          | Display the current finger table of the node.                              |\n| `state`       | Show the node's state, including its ID, predecessor, successor, and data. |\n| `upload`      | Upload a file to the network. Usage: `upload \u003cfile_path\u003e`                  |\n| `open`        | Open a file from the network. Usage: `open \u003cfile_name\u003e`                   |                  |\n| `files`       | List all files currently stored in the network.                           |\n| `debug`       | Toggle debug mode for detailed logs.                                       |\n| `leave`       | Gracefully leave the network.                                              |\n\n---\n\n## ✅ Verifying the Program Works\n\n### Test Case 1: Upload and Open a File\n\n1. Start two or more nodes in separate terminals.\n2. On one node, upload a file:\n   ```bash\n   upload test.txt\n   ```\n3. On another node, open the file using its name:\n   ```bash\n   open test.txt\n   ```\n\n### Test Case 2: List Files in the Network\n\n1. On any node, list all files stored in the network:\n   ```bash\n   files\n   ```\n\n### Test Case 3: Node Join and Leave\n\n1. Start a new node and join it to the network using the IP and port of an existing node.\n\n2. Verify the new node's state using the `state` command.\n\n3. Gracefully leave the network using the `leave` command and observe how the network stabilizes.\n\n---\n\n## 🛡️ Troubleshooting\n\n- **Port Already in Use**: Ensure the port you specify is not being used by another application.\n\n- **File Not Found**: Ensure the file path is correct when using the `upload` command.\n\n- **Connection Issues**: Verify that all nodes are running on the same network.\n\n---\n\n## 📖 How It Works\n\nThis project uses the **Chord protocol** to distribute files across a network of nodes. Each file is assigned a unique key using SHA-1 hashing, and nodes are responsible for storing files whose keys fall within their range. The finger table enables efficient lookups, reducing the number of hops required to find a file.\n\n---\n\n## 🚧 Missing Features and Future Improvements\n\n### Missing Features\n1. **Deletion Feature**: Add the ability to delete a file from any node that is a member of the network.\n\n2. **Abrupt Node Failure Handling**: Account for abrupt node failures that preserve files stored locally in the failing node.\n\n### Future Improvements\n1. **Replication**: Add redundancy by replicating files across multiple nodes to improve fault tolerance.\n\n2. **File Versioning**: Implement version control for files to handle updates and conflicts.\n\n3. **Dynamic Node Stabilization**: Improve the stabilization process to handle high churn rates more effectively.\n\n4. **Web Interface**: Create a user-friendly web-based interface for non-technical users.\n\n5. **Authentication and Security**: Add encryption and authentication mechanisms to secure file transfers and node communication.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshojiyao12%2Fbasic_chord-dfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshojiyao12%2Fbasic_chord-dfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshojiyao12%2Fbasic_chord-dfs/lists"}