# 9timbo9/cs-451- architecture

> Architecture diagram of the GitHub repository 9timbo9/cs-451-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/9timbo9/cs-451-
- Repository: https://github.com/9timbo9/cs-451-

## Overview

##### Project type and purpose
- This is a Python-based educational database engine (lstore) developed across three incremental modules (M1, M2, M3) for a university database course (CS451/551).
- Each “Project N” folder contains the core lstore library (storage, indexing, query, transaction) plus test harnesses and entry points.

##### File structure
- Top level:
- Project 1, Project 2, Project 3 – three versions of the engine.
- README.md, requirements.txt – project metadata.
- Inside each Project N:
- __main__.py – CLI/test entry point.
- exam_tester_*.py, m?_tester_*.py – automated test harnesses.
- lstore/ – the database library:
– M1: db.py, page.py, table.py, index.py, query.py, transaction.py, transaction_worker.py
– M2 adds bufferpool.py, config.py, disk.py
– M3 likely extends concurrency or recovery.
- Naming conventions (db, page, table, index, query, transaction) reveal an internal modular architecture.

##### README for additional insights
- We infer from filenames that the system implements a simplified storage engine with ACID transactions, buffer management, query interface, and index structures.

##### Elements
- Blue for storage layer,
- Green for transaction layer,
- Orange for query layer,
- Grey for test/CLI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "CLI/Test Harness"
        CLI_MAIN["__main__.py"]:::cli
        EX1["exam_tester_m2_part1.py"]:::cli
        EX2["exam_tester_m2_part2.py"]:::cli
        M2P1["m2_tester_part1.py"]:::cli
        M2P2["m2_tester_part2.py"]:::cli
    end

    subgraph "Query Layer"
        Query["Query Processor"]:::query
    end

    subgraph "Transaction Layer"
        TM["Transaction Manager"]:::transaction
        TW["Transaction Worker"]:::transaction
    end

    subgraph "Storage Engine"
        DB["DB Facade"]:::storage
        subgraph "Storage Core"
            BP["Buffer Pool"]:::storage
            DISK["Disk Manager"]:::storage
            CONF["Config"]:::storage
            PAGEM["Page Manager"]:::storage
            TAB["Table Module"]:::storage
            IDX["Index Module"]:::storage
        end
    end

    CLI_MAIN -->|"invokes"| Query
    EX1 -->|"invokes"| Query
    EX2 -->|"invokes"| Query
    M2P1 -->|"invokes"| Query
    M2P2 -->|"invokes"| Query

    Query -->|"calls"| TM
    TM -->|"spawns"| TW
    TM -->|"requests_page"| BP
    BP -->|"loads/saves"| DISK
    BP -->|"uses"| PAGEM
    TM -->|"orchestrates"| DB
    DB -->|"initializes"| BP
    DB -->|"initializes"| DISK
    DB -->|"initializes"| CONF
    Query -->|"accesses"| TAB
    Query -->|"accesses"| IDX

    click CLI_MAIN "https://github.com/9timbo9/cs-451-/blob/main/Project 2/__main__.py"
    click EX1 "https://github.com/9timbo9/cs-451-/blob/main/Project 2/exam_tester_m2_part1.py"
    click EX2 "https://github.com/9timbo9/cs-451-/blob/main/Project 2/exam_tester_m2_part2.py"
    click M2P1 "https://github.com/9timbo9/cs-451-/blob/main/Project 2/m2_tester_part1.py"
    click M2P2 "https://github.com/9timbo9/cs-451-/blob/main/Project 2/m2_tester_part2.py"
    click DB "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/db.py"
    click Query "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/query.py"
    click TM "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/transaction.py"
    click TW "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/transaction_worker.py"
    click BP "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/bufferpool.py"
    click DISK "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/disk.py"
    click CONF "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/config.py"
    click PAGEM "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/page.py"
    click TAB "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/table.py"
    click IDX "https://github.com/9timbo9/cs-451-/blob/main/Project 2/lstore/index.py"

    classDef cli fill:#cccccc,stroke:#333,stroke-width:1px
    classDef query fill:#ffa500,stroke:#333,stroke-width:1px
    classDef transaction fill:#90ee90,stroke:#333,stroke-width:1px
    classDef storage fill:#add8e6,stroke:#333,stroke-width:1px
```
