How goelk2004/virtual-file-system-engine works
Project type and purpose
• This is a systems‐level C++ project implementing a Virtual File System (VFS) from scratch. It simulates a real-world disk‐based file system (ext4/NTFS-like) with features such as journaling, permission management, metadata caching, multi‐filesystem mounting, crash recovery, and a command-line interface.
File structure
• Top-level files:
• Makefile – build script
• README.md – project overview
• LICENSE – copyright
• Directories:
• / – all public header files (interfaces for CLI, VFS, journaling, mount manager, metadata manager, etc.)
• src/ – implementation of each component; main.cpp is the entry point
• journal/ – runtime journal log file (write‐ahead logging)
README for extra insights
• Core subsystems called out: metadata (B+ tree), allocation (bitmap + extents), journaling, caching, mount management, multithreading, permission/user management.
• CLI commands define the external “UI” layer that invokes VFS operations.
Main components
a. Frontend/Presentation
• CLI Module (CLI.cpp/CLI.h, cliFunctions)
b. VFS Interface Layer
• VirtualFileSystem (VFS.cpp/VFS.h) – exposes create, read, write, mount, unmount, etc.
c. Core Services
• MetadataManager (metaDataManager.h/cpp; centralised metadata table, B+ Tree)
• AllocationManager (bitmap + extents; disk.cpp)
• JournalingSubsystem (journaling.h/cpp; write-ahead log in journal.log)
• RollbackManager (rollback.h/cpp; crash rollback logic)
• MountManager (mountManager.h/cpp; multi‐filesystem mounting)
• PermissionManager/UserManager (system.h, user/group related code)
• CacheManager (in-memory cache for superblock, metadata, bitmap)
• MultithreadingController (multithreading.h/cpp)
d. Data Layer
• Disk I/O Interface (disk.cpp/disk.h) – raw block reads/writes from myDisk.img
• Journal File (journal/journal.log)
Relationships and interactions
• CLI → Calls VFS interface (synchronous).
• VFS → invokes Core Services in layered order:
• PermissionManager → check ACLs
• MetadataManager → query/update file metadata
• AllocationManager → allocate/free blocks
• CacheManager → check/invalidate caches
• JournalingSubsystem → record operation in journal
• Disk I/O → commit blocks to myDisk.img
• RollbackManager → if crash/error, replay journal on startup
• MountManager handles routing of VFS calls to the correct disk instance.
• MultithreadingController synchronizes concurrent CLI operations.
Architectural patterns and design principles
• Layered architecture (Presentation → Interface → Services → Data)
• Single Responsibility per module (e.g., journaling only handles logs, allocation only handles blocks)
• Modular, pluggable components (e.g., you could swap B+ Tree for another index)
• Write‐Ahead Logging for fault tolerance
• In‐memory caching for performance
Relevant technologies/frameworks
• C++17 with custom classes and header/source separation
• Makefile for build orchestration
• Raw disk image file (myDisk.img) and journal.log for persistence