Skip to content

A comprehensive version control filesystem with FUSE integration and CLI tools

License

Notifications You must be signed in to change notification settings

Ghoulayush/time-machine-filesystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TMFS - Time Machine File System

A comprehensive version control filesystem that provides automatic file versioning through FUSE integration, CLI management tools, and robust storage backend.

πŸš€ Features

  • Automatic File Versioning: Every file modification is automatically versioned
  • FUSE Integration: Mount as a transparent filesystem - works with any application
  • CLI Management: Powerful command-line tools for version management
  • Virtual Directories: Browse file history through .versions/ directories
  • Storage Backend: Efficient block-based storage with SQLite metadata
  • Cross-Platform: Works on Linux, macOS, and other Unix-like systems

πŸ“ Project Structure

FileSystem/
β”œβ”€β”€ testospbl/              # Core storage backend
β”‚   β”œβ”€β”€ storage.py          # StorageManager implementation
β”‚   └── test_storage.py     # Storage tests
β”œβ”€β”€ fuse_layer/             # FUSE filesystem implementation
β”‚   β”œβ”€β”€ tmfs_fuse.py        # Main FUSE filesystem
β”‚   β”œβ”€β”€ mount_tmfs.py       # Mount utility
β”‚   β”œβ”€β”€ test_tmfs.py        # FUSE tests
β”‚   └── README.md           # FUSE documentation
β”œβ”€β”€ tmfs2/                  # CLI tools
β”‚   └── tmfs/src/
β”‚       β”œβ”€β”€ cli.py          # Main CLI interface
β”‚       └── commands/       # Individual commands
β”œβ”€β”€ complete_integration.py # Integration demo
└── requirements.txt        # Python dependencies

πŸ› οΈ Installation

  1. Clone the repository:

    git clone https://github.com/Ghoulayush/time-machine-filesystem.git
    cd time-machine-filesystem
  2. Install dependencies:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    pip install -r requirements.txt
  3. Install FUSE (if not already installed):

    # Ubuntu/Debian
    sudo apt-get install fuse libfuse-dev
    
    # macOS
    brew install macfuse
    
    # CentOS/RHEL
    sudo yum install fuse fuse-devel

πŸš€ Quick Start

1. Initialize TMFS Storage

cd your_project_directory
python -c "
import sys
sys.path.insert(0, '/path/to/tmfs/testospbl')
from storage import StorageManager
storage = StorageManager('.')
print('TMFS storage initialized!')
"

2. Mount FUSE Filesystem

# Create mount point
mkdir tmfs_mount

# Mount TMFS
python /path/to/tmfs/fuse_layer/mount_tmfs.py mount . tmfs_mount

# Now work with files in tmfs_mount/ - all changes are automatically versioned!
echo "Hello World" > tmfs_mount/hello.txt
echo "Version 2" > tmfs_mount/hello.txt

3. Use CLI Tools

# List file versions
python /path/to/tmfs/tmfs2/tmfs/src/main.py list hello.txt

# Show detailed version information
python /path/to/tmfs/tmfs2/tmfs/src/main.py list hello.txt --detailed

# Restore a specific version
python /path/to/tmfs/tmfs2/tmfs/src/main.py restore hello.txt --version-id v1

# Show storage statistics
python /path/to/tmfs/tmfs2/tmfs/src/main.py info --stats

4. Browse Version History

# List all versions of a file
ls tmfs_mount/.versions/hello.txt/

# Read a specific version
cat tmfs_mount/.versions/hello.txt/v1
cat tmfs_mount/.versions/hello.txt/v2

πŸ“– Usage Examples

Automatic Versioning Workflow

# Mount TMFS
python fuse_layer/mount_tmfs.py mount . mount_point

# Work normally - versioning is automatic
echo "First draft" > mount_point/document.txt
echo "Second draft" > mount_point/document.txt
echo "Final version" > mount_point/document.txt

# Check version history
python tmfs2/tmfs/src/main.py list document.txt
# Output:
# Found 3 versions for document.txt
# Version | Timestamp           | User
# ----------------------------------------
# v1      | 2025-11-09 15:30:00 | user
# v2      | 2025-11-09 15:31:00 | user
# v3      | 2025-11-09 15:32:00 | user

Version Management

# Restore to previous version
python tmfs2/tmfs/src/main.py restore document.txt --version-id v1

# Compare versions (planned feature)
python tmfs2/tmfs/src/main.py diff document.txt --version-a v1 --version-b v3

# Clean up old versions (planned feature)
python tmfs2/tmfs/src/main.py cleanup document.txt --keep-last 5

πŸ§ͺ Testing

Run the comprehensive test suite:

# Test storage backend
python testospbl/test_storage.py

# Test FUSE filesystem
python fuse_layer/test_tmfs.py

# Test complete integration
python complete_integration.py

πŸ—οΈ Architecture

Storage Layer (testospbl/)

  • Block-based storage: Files are stored in fixed-size blocks for efficiency
  • SQLite metadata: Version information, timestamps, and file relationships
  • Deduplication: Identical blocks are stored only once
  • Compression: Block-level compression support (planned)

FUSE Layer (fuse_layer/)

  • Transparent versioning: Files are automatically versioned on modification
  • Virtual directories: .versions/ directories provide access to file history
  • Standard operations: Full support for read, write, create, delete, etc.
  • Performance optimized: Efficient caching and lazy loading

CLI Layer (tmfs2/)

  • Modern interface: Clean, intuitive command-line tools
  • Rich output: Detailed formatting and progress indicators
  • Async support: Non-blocking operations for large datasets
  • Extensible: Plugin architecture for custom commands

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and test thoroughly
  4. Commit with clear messages: git commit -m "Add feature description"
  5. Push to your fork: git push origin feature-name
  6. Submit a pull request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ› Known Issues

  • FUSE unmounting requires manual fusermount -u on some systems
  • CLI commands need absolute paths for cross-directory imports
  • Performance optimization needed for very large files (>1GB)

πŸ—ΊοΈ Roadmap

  • v1.1: Web interface for version browsing
  • v1.2: File difference visualization
  • v1.3: Automated cleanup policies
  • v1.4: Network storage backends
  • v1.5: Real-time collaboration features

πŸ“ž Support


Note: This is an active development project. While functional, it's recommended for development and testing environments. Production use should be carefully evaluated.

About

A comprehensive version control filesystem with FUSE integration and CLI tools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published