A robust distributed file storage system designed to provide scalable, fault-tolerant storage across multiple nodes. This project implements consistent hashing, data replication, and a REST API interface for file operations, ensuring high availability and data integrity even during node failures.
The system follows a distributed architecture with the following components:
High-level architecture showing node communication and replication
public class ConsistentHash{ private final HashFunction hashFunction; private final int numberOfReplicas; private final SortedMap circle = new TreeMap<>(); public ConsistentHash(HashFunction hashFunction, int numberOfReplicas, Collection nodes) { this.hashFunction = hashFunction; this.numberOfReplicas = numberOfReplicas; for (T node : nodes) { add(node); } } // Code continues... }
@RestController @RequestMapping("/api/files") public class FileController { @PostMapping("/upload") public ResponseEntityuploadFile(@RequestParam("file") MultipartFile file) { // File upload logic } @GetMapping("/{fileId}") public ResponseEntity downloadFile(@PathVariable String fileId) { // File download logic } // Additional endpoints... }
Test coverage showing over 90% code coverage across core components
Performance benchmarks showing throughput vs. number of nodes