The DFS (Distributed File System) project is a peer-to-peer file sharing system with two main components:
- DFS Engine: The core backend system that handles file distribution and peer management.
- Client UI: A web-based interface for interacting with the DFS Engine.
- dfs-engine/: Contains the Rust-based backend implementation.
- client-ui/: Contains the React-based frontend implementation.
- Peer-to-peer file sharing and synchronization.
- REST API endpoints for file upload, download, and peer management.
- Distributed Hash Table (DHT) for file location tracking.
- TCP-based communication for peer-to-peer messaging.
- Efficient message serialization using
bincode
.
- File upload interface.
- File listing and download functionality.
- Peer management interface.
- Node uptime display.
- Node Initialization:
- Creates an empty
FileSystem
. - Initializes an empty peer list.
- Sets up DHT and uptime counter.
- Starts a TCP listener for peer connections.
- Creates an empty
- Peer Synchronization:
- Requests peer file lists and exchanges missing files.
- Updates the DHT with new file locations.
- File Upload:
- Splits files into chunks, hashes them, and distributes them across the network.
- File Download:
- Retrieves file chunks from peers and reassembles them.
- File Deletion:
- Removes file metadata and notifies peers.
-
Implement WebSockets for Real-Time Updates:
- Establish a WebSocket connection with the backend.
- Use WebSockets to receive real-time updates for file uploads, peer additions, and synchronization events.
-
Enhance Error Management:
- Display user-friendly error messages for failed API calls (e.g., file not found, invalid peer address).
- Add retry mechanisms for transient errors.
- Handle WebSocket connection errors gracefully (e.g., reconnection attempts).
-
Set Up WebSocket Server:
- Add a WebSocket server to the existing backend to enable real-time communication.
- Broadcast events like file uploads, deletions, and peer additions to connected clients.
-
Improve Error Management:
- Ensure proper error handling for REST API endpoints (e.g., invalid input, internal server errors).
- Return descriptive error messages to the client.
- Add logging for better debugging and monitoring.
- Ensure Rust and Cargo are installed for the backend.
- Ensure Node.js and npm/yarn are installed for the frontend.
- Navigate to the
dfs/
directory:cd dfs/ ./run.sh