Skip to content

Latest commit

Β 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CAF - Content Addressable Filesystem

Advanced Systems Programming - CAF Project

A lightweight version control system similar to Git, written in Python and C++. CAF serves as an educational project for understanding how complex distributed version control systems work under the hood.

Test CI

🌟 Project Overview

CAF (Content Addressable Filesystem) is a simplified version control system that implements core Git-like functionality including:

  • Repository initialization and management
  • File content hashing and storage
  • Commit creation and tracking
  • Branch management
  • File system operations with content-addressable storage

The project demonstrates the fundamental concepts behind modern version control systems, including content-addressable storage, object models, and distributed workflows.

πŸ—οΈ Architecture

CAF is built as a hybrid Python/C++ system:

  • Python Layer: Command-line interface, high-level repository operations, and user-facing functionality
  • C++ Core: High-performance hashing, object storage, and low-level file operations
  • Integration: Python bindings using pybind11 for seamless interoperability

Key Components

  • caf/: Python CLI application and command implementations
  • libcaf/: Core C++ library with Python bindings
  • tests/: Comprehensive test suite for both Python and C++ components

πŸš€ Quick Start

Prerequisites

  • Docker (recommended for consistent environment)
  • Python 3.10+
  • CMake 3.15+ and C++17 compiler

Using Docker (Recommended)

  1. Build and run the development container:

    make run
  2. Attach to the container:

    make attach
  3. Deploy the project inside the container:

    make deploy
  4. Run tests to verify setup:

    make test

    or

    pytest

πŸ’» Usage

Basic Commands

Initialize a new repository:

caf init

Create a commit:

caf commit --author "Your Name" --message "Initial commit"

Hash a file and optionally store it:

caf hash_file path/to/file.txt --write

Manage branches:

caf add_branch feature-branch
caf delete_branch old-branch
caf branch                    # List all branches
caf branch_exists my-branch   # Check if a branch exists

View repository history and changes:

caf log                       # Show commit log
caf diff commit1 commit2      # Compare two commits

Repository management:

caf delete_repo              # Delete the repository

Get help:

caf --help
caf <command> --help

πŸ§ͺ Testing

The project includes comprehensive tests for both Python and C++ components:

  • Run all tests: make test
  • Test with coverage: make test ENABLE_COVERAGE=1(C++ coverage available only if compiled with coverage)

πŸ“ Project Structure

asp-caf-assignment/
β”œβ”€β”€ Dockerfile                # Development environment setup
β”œβ”€β”€ Makefile                  # Build and development commands
β”œβ”€β”€ assignment/               # Assignment source
β”œβ”€β”€ caf/                      # Python CLI application
β”‚   β”œβ”€β”€ pyproject.toml        # Python package configuration
β”‚   └── caf/                  # CLI source code
β”‚       β”œβ”€β”€ __main__.py       # Entry point
β”‚       β”œβ”€β”€ cli.py            # Command-line interface
β”‚       └── cli_commands.py   # Command implementations
β”œβ”€β”€ libcaf/                   # Core C++ library
β”‚   β”œβ”€β”€ CMakeLists.txt        # CMake build configuration
β”‚   β”œβ”€β”€ pyproject.toml        # Python package configuration
β”‚   β”œβ”€β”€ libcaf/               # Python interface and higher-level repo operations
β”‚   β”‚   β”œβ”€β”€ constants.py      # Constants and configuration
β”‚   β”‚   β”œβ”€β”€ plumbing.py       # Low-level repo operations
β”‚   β”‚   β”œβ”€β”€ ref.py            # Reference handling
β”‚   β”‚   └── repository.py     # Repository management and high-level API
β”‚   └── src/                  # C++ source code
β”‚       β”œβ”€β”€ bind.cpp          # Python bindings
β”‚       β”œβ”€β”€ blob.h            # Blob object definitions
β”‚       β”œβ”€β”€ caf.cpp/h         # Low-level C++ implementation
β”‚       β”œβ”€β”€ commit.h          # Commit object definitions
β”‚       β”œβ”€β”€ hash_types.cpp/h  # Hashing implementations
β”‚       β”œβ”€β”€ object_io.cpp/h   # Object I/O operations
β”‚       β”œβ”€β”€ tree.h            # Tree object definitions
β”‚       └── tree_record.h     # Tree record structures
└── tests/                    # Test suite
    β”œβ”€β”€ caf/                  # CLI tests
    └── libcaf/               # Core library tests

πŸ”§ Development

Available Make Targets

  • make build-container - Build Docker development image
  • make run - Start development container
  • make attach - Connect to running container
  • make stop - Stop running container
  • make deploy/deploy-libcaf/deploy-caf - Install libcaf and caf packages, or both
  • make test - Run complete test suite (use ENABLE_COVERAGE=1 to collect coverage information)
  • make clean - Remove build artifacts

Code Quality

The project follows Python and C++ best practices:

  • Type hints in Python code
  • Comprehensive test coverage
  • Clear documentation and comments
  • Consistent code formatting

πŸŽ“ Educational Context

This project is part of the Advanced Systems Programming course (ASP) and serves as a hands-on introduction to:

  • Systems Programming: Working with multi-language codebases
  • Version Control Internals: Understanding how Git-like systems work
  • Software Architecture: Designing modular, maintainable systems
  • Testing and Debugging: Ensuring code quality and reliability
  • Build Systems: Managing complex build processes

Students work through various tasks including:

  1. Code analysis and architecture mapping
  2. Environment setup and testing
  3. Debugging and fixing issues
  4. Implementing new features (like tagging systems)

🀝 Contributors

Initial Development

  • Meshi, Bar and Omer - Initial design and implementation (March 2025)
  • Ido - Refactoring, cleanup, consistency and beauty pass (June 2025)
  • You? - Your work here! (August 2025)

πŸ“š Learning Resources

To better understand the concepts behind CAF, consider exploring:

Version Control & Systems Programming

Python Programming

C++ Programming

Python-C++ Integration

Core Computer Science Concepts

Development Tools & Practices

Systems Programming

Advanced Topics

πŸ“„ License

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

While developed for educational purposes as part of the Advanced Systems Programming course, the code is available under MIT License for learning and reference.

πŸ› Issues and Support

If you encounter issues:

  1. Check that Docker is running and up to date
  2. Ensure all dependencies are properly installed
  3. Run the test suite to identify specific problems
  4. Consult the course staff for technical assistance

Built with ❀️ for learning systems programming and version control internals

About

An introduction assignment based of the Content Addressable Filesystem project for the Advanced Systems Programming 2026 class at Ben-Gurion University of the Negev

Resources

Stars

3 stars

Watchers

1 watching

Forks

Contributors

Languages