ALESTA1 / dfs

5 stars 0 forks source link

Distributed File System

A simple yet functional distributed file system implementation inspired by a CMU course project. The system features a centralized Naming Server architecture with distributed Storage Servers, supporting file replication and lock-based consistency.

πŸ—οΈ Architecture

Naming Server

Storage Servers

πŸ” Lock Management

The system implements two types of locks for file access:

Note: Due to architectural constraints, shared locks are treated as write operations, and exclusive locks are treated as read operations at the implementation level.

πŸ“¦ Features

Automatic Replication

Consistency Management

πŸš€ Getting Started

Prerequisites

Starting the Naming Server

Navigate to the naming directory and run:

go run . <Client_Service_Port> <Slave_Registration_Port>

Example:

go run . 8080 8081

Starting a Storage Server

Navigate to the storage directory and run:

go run . <Client_Service_Port> <Command_Port> <Registration_Port> <Storage_Directory> <Naming server ip>

Example:

go run . 9090 9091 8081 storage1 localhost

πŸ’‘ Implementation Notes

Storage Directory Handling

Client Expectations

  1. Clients must request appropriate locks before file operations
  2. Locks should be released after operations complete
  3. Cooperative access model is assumed

πŸ” System Assumptions

  1. Clients follow the locking protocol:

    • Acquire appropriate locks before operations
    • Release locks after completing operations
    • Use shared locks for reads and exclusive locks for writes
  2. File Replication:

    • System maintains consistency across replicas
    • Latest version access is guaranteed
    • Non-blocking operations during normal usage

πŸ“š Technical Details

Replication Mechanism

Consistency Protocol

🀝 Contributing

Feel free to submit issues and enhancement requests.

πŸ™ Acknowledgments

This project is inspired by a CMU course project. For detailed project requirements, refer to the original course materials.