Skip to content

In-Memory File System via Java Object Serialization

Notifications You must be signed in to change notification settings

rprahadeep/MemFS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 MemFS - In-Memory File System Simulator

A UNIX-style, in-memory file system simulator built in Java, exposed via RESTful APIs using Spring Boot and a CLI for interactive shell-based access.

Supports core file and directory operations (mkdir, ls, cd, touch, write, cat) with persistence via Java serialization and is fully Dockerized for portable deployment.


Features

  • 🗂️ Simulates a hierarchical file system using an n-ary tree structure
  • 🛠️ Shell-like operations: mkdir, cd, ls, touch, cat, write
  • 🌐 Exposed via Spring Boot REST APIs
  • 💻 Interactive CLI for direct terminal usage
  • 💾 Persistent state using Java serialization (filesystem.ser)
  • 🐳 Dockerized for consistent deployment

Tech Stack

  • Language: Java 17
  • Framework: Spring Boot
  • Build Tool: Maven
  • Persistence: Java Object Serialization
  • Containerization: Docker
  • CLI: Java Console (Scanner)

📂 Project Structure

src/main/java/com/memfs/memfs
├── MemfsApplication.java           # Spring Boot entry point
├── model/
│   └── FileNode.java               # Represents files/directories
├── service/
│   └── FileSystemService.java     # Core logic & persistence
├── controller/
│   └── FileSystemController.java  # REST API layer
└── cli/
    └── MemfsCliRunner.java        # Terminal-based CLI interface

🌐 REST API Endpoints

Base URL: http://localhost:8080/api/fs

Method Endpoint Description
POST /mkdir Create directory
GET /ls List directory contents
POST /touch Create empty file
GET /cat Read file content
POST /write Write content to file
POST /cd Change directory

CLI Mode

Run MemfsCliRunner to use the interactive shell:

> mkdir projects
> cd projects
> touch readme.txt
> write readme.txt Hello MemFS!
> cat readme.txt
Hello MemFS!
> ls
[readme.txt]

🐳 Docker

Build Image

docker build -t memfs .

Run Container

docker run -p 8080:8080 memfs

About

In-Memory File System via Java Object Serialization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published