# eellak/build-recorder architecture

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

- Interactive diagram: https://gitdiagram.com/eellak/build-recorder
- Repository: https://github.com/eellak/build-recorder

## Overview

##### Main System Components

a) Command Line Interface Layer
- Entry point (main.c)
- Command processing and initialization
- Output file handling

b) Core Tracing System
- Process tracer component (tracer.c)
- Record management (record.c, record.h)
- Hash computation system (hash.c, hash.h)

c) Data Management Layer
- Type definitions (types.h)
- RDF Turtle output generation
- File system interactions

##### Specific Implementation Details

Use these visual elements:

a) Components:
- Rectangle: Main process components
- Hexagon: System call interception points
- Diamond: Decision points in the tracing logic

- Blue: Core tracing components
- Green: File system interactions
- Yellow: Data processing components
- Gray: External system elements (build process being traced)

##### Key Relationships to Highlight

- Bidirectional relationship between tracer and target process
- File system monitoring paths
- Demonstrate data flow from system call interception to RDF generation

**Top Layer: User Interface/Input**
**↓**
**Middle Layer: Process Tracing & Monitoring**
**↓**
**Bottom Layer: Data Processing & Output Generation**

##### Additional Notes

- A note about the LGPL-2.1-or-later license
- Version compatibility information (Linux 5.3+)
- Integration points with build systems

This architecture reflects a tool that operates at the system level while maintaining a clean, modular design that separates core functionality (tracing, recording, hashing) from input/output handling.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef cli fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef core fill:#ff9999,stroke:#333,stroke-width:2px
    classDef data fill:#99ff99,stroke:#333,stroke-width:2px
    classDef external fill:#e6e6e6,stroke:#333,stroke-width:2px
    classDef storage fill:#ffcc99,stroke:#333,stroke-width:2px
    classDef note fill:#ffffcc,stroke:#333,stroke-width:2px

    %% User Input Layer
    UserInput["User Build Command"]:::external
    CLI["Command Line Interface"]:::cli
    click CLI "https://github.com/eellak/build-recorder/blob/main/src/main.c"

    %% Core Tracing Layer
    subgraph Tracing["Process Tracing Layer"]
        Tracer["Process Tracer"]:::core
        SysCallInt["System Call Interceptor"]:::core
        BuildProc["Build Process"]:::external
    end
    click Tracer "https://github.com/eellak/build-recorder/blob/main/src/tracer.c"

    %% Data Management Layer
    subgraph DataMgmt["Data Management Layer"]
        RecordMgr["Record Manager"]:::data
        HashComp["Hash Computer"]:::data
        TypeDef["Type Definitions"]:::data
    end
    click RecordMgr "https://github.com/eellak/build-recorder/blob/main/src/record.c"
    click HashComp "https://github.com/eellak/build-recorder/blob/main/src/hash.c"
    click TypeDef "https://github.com/eellak/build-recorder/blob/main/src/types.h"

    %% Output Generation Layer
    subgraph Output["Output Generation"]
        RDFGen["RDF Generator"]:::data
        Schema["RDF Schema"]:::data
        OutputFile["Output File"]:::storage
    end
    click Schema "https://github.com/eellak/build-recorder/blob/main/doc/build-recorder-schema.ttl"
    click OutputFile "https://github.com/eellak/build-recorder/blob/main/doc/output.md"

    %% Relationships
    UserInput --> CLI
    CLI --> Tracer
    Tracer <--> SysCallInt
    SysCallInt <--> BuildProc
    SysCallInt --> RecordMgr
    RecordMgr --> HashComp
    RecordMgr --> RDFGen
    TypeDef -.-> RecordMgr
    Schema -.-> RDFGen
    RDFGen --> OutputFile

    %% Notes
    Note["Requirements:<br/>- Linux 5.3+<br/>- libcrypto<br/>License: LGPL-2.1-or-later"]:::note

    %% Legend
    subgraph Legend
        L1["CLI Components"]:::cli
        L2["Core Components"]:::core
        L3["Data Components"]:::data
        L4["External Components"]:::external
        L5["Storage"]:::storage
        L6["Notes"]:::note
    end
```
