# jbeyers/mrmr architecture

> Architecture diagram of the GitHub repository jbeyers/mrmr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jbeyers/mrmr
- Repository: https://github.com/jbeyers/mrmr

## Overview

##### Main Components
- Media Repository Manager & Entry Points:
- Main execution files like app.py (which likely serves as the central controller) and sambasync.py (which might handle synchronization with Samba shares).
- Synchronization & Communication Modules:
- Samba synchronization component. This component, based on sambasync.py and associated configuration, is responsible for interfacing with external media shares.
- Redundancy and Data Integrity:
- Parity module/logic. The presence of docs/decisions files on “use-shifted-parity” and the parity_experiment.py script in the scripts directory indicate that a specialized, shifted parity algorithm is used for data redundancy.
- FUSE Integration (If Applicable):
- Supporting Documentation and Build/Config Tools:

##### Relationships and Data Flow
- Client/User Interface:
- Media Repository Manager (app.py):
- FUSE Filesystem (fusepy Integration):
- Parity Computation Engine:
- A separate module/component responsible for executing the shifted parity algorithm. Indicate that this component processes data from the repository manager and outputs parity data that is used for redundancy.
- Samba Synchronization Module:
- External Storage or Drives:
- One or more external media drives or storage systems that receive data from both the parity engine and the synchronization component.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- How distinct components (repository manager, FUSE interface, parity engine, and sync module) each handle specific parts of the workflow.
- Modular Design:
- Data Flow and Redundancy:
- Flow of media data and parity information—from ingestion through processing to synchronization with external drives.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Components
    CLIENT["Client"]:::client
    MGR["Media Repository Manager (app.py)"]:::core
    FUSE["FUSE Filesystem Interface (fusepy)"]:::core
    PARITY["Parity Computation Engine (Shifted Parity)"]:::parity
    SAMBA["Samba Sync Module (sambasync.py)"]:::sync
    STORAGE["External Media Storage"]:::module

    %% Supporting Artifacts Subgraph
    subgraph "Supporting Artifacts"
        DOCS["Documentation"]:::documents
        MAKEFILE["Makefile"]:::documents
        REQ["requirements.txt"]:::documents
    end

    %% Relationships / Data Flow
    CLIENT -->|"initiates"| MGR
    MGR -->|"mounts via fusepy"| FUSE
    MGR -->|"triggers parity computation"| PARITY
    MGR -->|"initiates synchronization"| SAMBA
    FUSE -->|"handles filesystem events"| SAMBA
    PARITY -->|"sends parity data"| STORAGE
    SAMBA -->|"syncs media files"| STORAGE

    %% Additional Annotation for Parity Decision Document
    PARITY_DOC["Parity Decision Doc"]:::documents
    PARITY ---|"ref: shifted parity decision"| PARITY_DOC

    %% Additional Annotation for FUSE Decision Document
    FUSE_DOC["FUSE Decision Doc"]:::documents
    FUSE ---|"ref: fusepy decision"| FUSE_DOC

    %% Click Events for Core Components
    click MGR "https://github.com/jbeyers/mrmr/blob/master/app.py"
    click SAMBA "https://github.com/jbeyers/mrmr/blob/master/sambasync.py"
    click PARITY "https://github.com/jbeyers/mrmr/blob/master/scripts/parity_experiment.py"
    click FUSE "https://github.com/jbeyers/mrmr/blob/master/docs/decisions/0002-use-fusepy.md"
    click PARITY_DOC "https://github.com/jbeyers/mrmr/blob/master/docs/decisions/0003-use-shifted-parity.md"
    
    %% Click Events for Supporting Artifacts
    click DOCS "https://github.com/jbeyers/mrmr/tree/master/docs/"
    click MAKEFILE "https://github.com/jbeyers/mrmr/tree/master/Makefile"
    click REQ "https://github.com/jbeyers/mrmr/blob/master/requirements.txt"

    %% Styles
    classDef client fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef core fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef parity fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef sync fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef module fill:#e2e3e5,stroke:#41464b,stroke-width:2px;
    classDef documents fill:#d4edda,stroke:#155724,stroke-width:2px;
```
