# csrbapp/csrbbin architecture

> Architecture diagram of the GitHub repository csrbapp/csrbbin, 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/csrbapp/csrbbin
- Repository: https://github.com/csrbapp/csrbbin

## Overview

##### Main Components

a) Core Components:
- CSRBnode (Primary network node component)
- CSRBvfsFUSE (FUSE-based virtual filesystem component)
- CSRB Network Router (External component)
- Storage Layer (LevelDB-based)

b) Integration Components:
- FUSE Interface
- Network Layer (UDP-based communication)
- P2P Discovery System (LAN mode)
- MicroPython Runtime (Optional component)

##### Key Relationships to Highlight

- Data flow between CSRBnode instances (UDP communication)
- FUSE filesystem operations
- Storage operations
- P2P discovery connections
- Router-mediated communications

##### Technical Details

Annotations for:
- Timeout configurations
- Thread pool sizes
- Cache settings
- Network pacing parameters
- FUSE configuration options

##### Component Interactions

Specific flows for:
- VFS operations
- Network command processing
- P2P discovery
- Storage operations
- MicroPython code execution

##### The configuration flexibility

Remember to include notes about the containerization support (Docker) and the various supported operating systems (Ubuntu, OpenBSD, NetBSD) as deployment options.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        APP[Client Applications]
        FUSE[FUSE Mount Points]
        VFSAPI[VFS API]:::vfsapi
    end

    subgraph Core["Core Layer"]
        direction TB
        subgraph NodeComponents["Node Components"]
            NODE[CSRBnode]:::node
            VFSFUSE[CSRBvfsFUSE]:::vfsfuse
            FUSEAPI[FUSE Interface]:::fuseapi
            PROTO[Network Protocol]:::proto
        end

        subgraph Processing["Processing Layer"]
            WORKERS[Worker Threads Pool]
            CMD[Command Processing]
            P2P[P2P Discovery System]
        end
    end

    subgraph Infrastructure["Infrastructure Layer"]
        ROUTER[CSRB Network Router]
        STORAGE[(LevelDB Storage)]
        CERTS[Certificate Management]:::certs
        DOCKER[Docker Container]:::docker
    end

    %% Relationships
    APP --> FUSE
    FUSE --> VFSAPI
    VFSAPI --> NODE
    NODE --> VFSFUSE
    VFSFUSE --> FUSEAPI
    NODE --> PROTO
    PROTO --> P2P
    PROTO --> ROUTER
    NODE --> WORKERS
    WORKERS --> CMD
    CMD --> STORAGE
    NODE --> CERTS
    
    %% Click Events
    click NODE "https://github.com/CSRBapp/CSRBbin/blob/master/UBUNTU-22.04-arm64/CSRBnode.enc"
    click VFSFUSE "https://github.com/CSRBapp/CSRBbin/blob/master/UBUNTU-22.04-arm64/CSRBvfsFUSE.enc"
    click CERTS "https://github.com/CSRBapp/CSRBbin/blob/master/CERTS/CA.nodes.csrb.crt"
    click FUSEAPI "https://github.com/CSRBapp/CSRBbin/blob/master/pyCSRB/CSRBfuseAPI.py"
    click PROTO "https://github.com/CSRBapp/CSRBbin/blob/master/pyCSRB/CSRBprotocolMessage.py"
    click VFSAPI "https://github.com/CSRBapp/CSRBbin/blob/master/pyCSRB/CSRBvfsAPI.py"
    click DOCKER "https://github.com/CSRBapp/CSRBbin/tree/master/Dockerfile"

    %% Styles
    classDef node fill:#2374ab
    classDef vfsfuse fill:#48a9a6
    classDef fuseapi fill:#4ad66d
    classDef proto fill:#9c528b
    classDef storage fill:#f4845f
    classDef certs fill:#f7b32b
    classDef docker fill:#c9cba3
    classDef vfsapi fill:#1a936f

    %% Legend
    subgraph Legend
        L1[Core Components]:::node
        L2[File System]:::vfsfuse
        L3[Network]:::proto
        L4[Security]:::certs
        L5[Storage]:::storage
    end
```
