# mpartel/bindfs architecture

> Architecture diagram of the GitHub repository mpartel/bindfs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mpartel/bindfs
- Repository: https://github.com/mpartel/bindfs

## Overview

##### Main Components

a. Core Components:
- FUSE Interface Layer
- Permission Management System
- Directory Mirroring System
- Rate Limiting Component
- User/Group Mapping System

b. Supporting Components:
- Memory Management (Arena)
- Debug/Logging System
- Configuration Handler

##### Component Relationships

**User Applications**
- ↕
- bindfs
- ↕
**FUSE Interface**
- ↕
**Core Components (show parallel components):**
**┌─────────────────────────────────────┐**
- Directory    Permission    User     │
- Mirroring  ↔ Management ↔ Mapping   │
- System       System       System    │
- ┘
- ↕           ↕          ↕
- Rate Limiter  Arena    Debug System
- ↕           ↕          ↕
**Operating System / Real Filesystem**

##### Implementation Details to Highlight

Key files and their roles:
- bindfs.c: Main entry point
- usermap.c: User/group mapping
- permchain.c: Permission management
- rate_limiter.c: I/O rate limiting
- arena.c: Memory management

##### Testing/Development Components

A separate section showing:
- Test infrastructure
- Vagrant-based testing environments
- Internal test components

##### Operational Flow

- Request flow from user space to real filesystem
- Permission checking sequence
- User/group mapping process
- Rate limiting checks

##### Notes Section

Notes about:
- FUSE version compatibility (2.8.0+ and 3.x)
- System requirements
- Configuration dependencies (user_allow_other in /etc/fuse.conf)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User_Space
        UA[User Applications]
    end

    subgraph FUSE_Layer
        FI["FUSE Interface"]:::fuse
        click FI "https://github.com/mpartel/bindfs/blob/master/src/bindfs.c"
    end

    subgraph Core_Components
        direction TB
        DM["Directory Mirroring System"]:::core
        PM["Permission Management"]:::security
        click PM "https://github.com/mpartel/bindfs/blob/master/src/permchain.c"
        UM["User/Group Mapping"]:::security
        click UM "https://github.com/mpartel/bindfs/blob/master/src/usermap.c"
    end

    subgraph Support_Systems
        direction TB
        RL["Rate Limiter"]:::security
        click RL "https://github.com/mpartel/bindfs/blob/master/src/rate_limiter.c"
        AR["Memory Arena"]:::support
        click AR "https://github.com/mpartel/bindfs/blob/master/src/arena.c"
        DS["Debug System"]:::support
        click DS "https://github.com/mpartel/bindfs/blob/master/src/debug.c"
    end

    subgraph Testing_Infrastructure
        direction TB
        TI["Internal Tests"]:::test
        click TI "https://github.com/mpartel/bindfs/tree/master/tests/internals"
        VE["Vagrant Environments"]:::test
        click VE "https://github.com/mpartel/bindfs/tree/master/vagrant"
        TC["Test Components"]:::test
        click TC "https://github.com/mpartel/bindfs/blob/master/tests/test_bindfs.rb"
    end

    subgraph OS_Layer
        OS["Operating System"]
        RF["Real Filesystem"]
    end

    %% Connections
    UA <--> FI
    FI <--> DM
    DM <--> PM
    PM <--> UM
    
    DM --> RL
    DM --> AR
    DM --> DS
    
    RL --> OS
    AR --> OS
    DS --> OS
    
    OS <--> RF

    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef security fill:#F44336,stroke:#C62828,color:white
    classDef support fill:#FFC107,stroke:#FFA000,color:black
    classDef fuse fill:#4CAF50,stroke:#2E7D32,color:white
    classDef test fill:#9C27B0,stroke:#6A1B9A,color:white
    
    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Security Components"]:::security
        L3["Support Systems"]:::support
        L4["FUSE Interface"]:::fuse
        L5["Testing Infrastructure"]:::test
    end
```
