# amsen20/pollerbear architecture

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

- Interactive diagram: https://gitdiagram.com/amsen20/pollerbear
- Repository: https://github.com/amsen20/pollerbear

## Overview

##### Main Components

a) Core Components:
- Epoll Interface Layer
- Runtime System
- Internal Utilities
- Logging System

b) Component Organization:

Bottom Layer:
- Native Epoll System (External)

Middle Layer:
- Epoll Interface Components
- Internal Utilities

Top Layer:
- Runtime Poller Implementation
- Logging System

##### Relationships and Interactions

- Utility connections to all components
- Logging system connections to all major components

##### Detailed Component Breakdown

Epoll Interface Layer (Rectangle):
- Epoll.scala
- EpollEvents.scala
- EpollError.scala

Runtime Layer (Rectangle):
- Poller.scala (Interface)
- PollerImpl.scala (Implementation)
- PollerError.scala (Error Handling)

Support Systems (Rounded Rectangles):
- Internal DS.scala (Data Structures)
- Utils.scala (Utilities)
- PBLogger.scala (Logging)

##### Specific Implementation Details

- Event handling flow
- Error propagation paths
- Resource management
- Threading model

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef external fill:#FFE873,stroke:#333
    classDef core fill:#AED6F1,stroke:#333
    classDef error fill:#F1948A,stroke:#333
    classDef utility fill:#A9DFBF,stroke:#333
    classDef testing fill:#D7BDE2,stroke:#333
    classDef logger fill:#FAD7A0,stroke:#333

    %% External System
    NativeEpoll["Linux Epoll System"]:::external

    %% Core Layers
    subgraph EpollInterface["Epoll Interface Layer"]
        EpollMain["Epoll Interface"]
        EpollEvents["Event Handling"]
        EpollErr["Error Handling"]
    end

    subgraph RuntimeSystem["Runtime System"]
        PollerInterface["Poller Interface"]
        PollerImpl["Poller Implementation"]
        PollerErr["Error Handling"]
    end

    %% Support Systems
    subgraph Support["Support Systems"]
        DS["Data Structures"]
        Utils["Utility Functions"]
        Logger["PB Logger"]
    end

    %% Testing Layer
    subgraph Testing["Testing Components"]
        ThreadTest["Thread Safety Tests"]
        DeadlineTest["Deadline Tests"]
        IntegrationTest["Integration Tests"]
        PipeTest["Pipe Scenario Tests"]
    end

    %% Relationships
    NativeEpoll <--> EpollMain
    EpollMain --> EpollEvents
    EpollMain --> EpollErr
    EpollInterface --> RuntimeSystem
    PollerInterface --> PollerImpl
    PollerImpl --> PollerErr
    DS --> RuntimeSystem
    DS --> EpollInterface
    Utils --> RuntimeSystem
    Utils --> EpollInterface
    Logger --> RuntimeSystem
    Logger --> EpollInterface
    Testing --> RuntimeSystem

    %% Click Events
    click EpollMain "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/epoll/Epoll.scala"
    click EpollEvents "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/epoll/EpollEvents.scala"
    click EpollErr "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/epoll/EpollError.scala"
    click PollerInterface "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/runtime/Poller.scala"
    click PollerImpl "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/runtime/PollerImpl.scala"
    click PollerErr "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/runtime/PollerError.scala"
    click DS "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/internal/DS.scala"
    click Utils "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/internal/Utils.scala"
    click Logger "https://github.com/amsen20/pollerBear/blob/main/pollerBear/src/main/scala/logger/PBLogger.scala"
    click ThreadTest "https://github.com/amsen20/pollerBear/blob/main/tests/src/test/scala/MultiThreadedSuite.scala"
    click DeadlineTest "https://github.com/amsen20/pollerBear/blob/main/tests/src/test/scala/DeadlineSuite.scala"
    click IntegrationTest "https://github.com/amsen20/pollerBear/blob/main/tests/src/test/scala/MixedScenarioSuite.scala"
    click PipeTest "https://github.com/amsen20/pollerBear/blob/main/tests/src/test/scala/PipeScenarioSuite.scala"

    %% Legend
    subgraph Legend
        L1["External System"]:::external
        L2["Core Component"]:::core
        L3["Error Handler"]:::error
        L4["Utility"]:::utility
        L5["Testing"]:::testing
        L6["Logger"]:::logger
    end
```
