# tpill90/steam-lancache-prefill architecture

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

- Interactive diagram: https://gitdiagram.com/tpill90/steam-lancache-prefill
- Repository: https://github.com/tpill90/steam-lancache-prefill

## Overview

##### Main Components

a. Core Components:
- Steam Integration Layer (SteamManager, Steam3Session)
- CLI Interface Layer (CliCommands)
- Download Management System (DownloadHandler)
- Cache Management Layer (Handlers)
- Configuration System (Settings)

b. External Systems:
- Steam CDN Servers
- Lancache Server
- Steam Authentication Services
- Steam Charts Service

##### Component Relationships

**[User CLI Interface] → [Steam Manager]**
- ↘ [Configuration System]

**[Steam Manager] → [Steam Integration Layer] → [Steam Services]**
- → [Download Handler] → [CDN Pool] → [Steam CDN]
- → [Lancache Server]

**[Steam Integration Layer] → [License Manager]**
- → [App Info Handler]
- → [Manifest Handler]

##### Specific Implementation Details

- Blue: Core application components (SteamManager, Handlers)
- Green: External services (Steam CDN, Lancache)
- Yellow: Authentication components (Steam3Session, LicenseManager)
- Gray: Support systems (Configuration, CLI)

##### Key Architectural Patterns to Highlight

a. Command Pattern Implementation:
- Relationship between Program.cs and the CliCommands directory
- How different commands (Prefill, Benchmark, etc.) are structured

b. Handler Pattern:
- Separation of concerns in the Handlers directory
- How AppInfoHandler, DepotHandler, and DownloadHandler interact

##### Important Details

- Authentication flow
- Download request path
- Cache interaction path
- Configuration loading path

- Clearly marked boundaries between:
- Application components
- External services
- User interaction points

##### Notes for Implementation

- Keep the main flow clear and centered
- Related components together
- Version checking and update notification system

- The high-performance nature of the system
- The separation between download management and cache interaction
- The robust error handling system (shown by the various exception types)
- The clean separation of concerns in the architecture

Remember to include annotations about the zero-disk-write architecture and the ability to scale to 100Gbit/s, as these are key distinguishing features of the system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph CLI
        CLI_INT[CLI Interface]:::cli
        BENCH[Benchmark System]:::cli
    end

    subgraph Core
        STEAM_MGR[Steam Manager]:::core
        DOWN_MGR[Download Handler]:::core
        APP_INFO[App Info Handler]:::core
        MAN_HAND[Manifest Handler]:::core
        DEP_HAND[Depot Handler]:::core
        CDN_POOL[CDN Pool]:::core
    end

    subgraph Steam
        STEAM_INT[Steam Integration]:::steam
        STEAM_SESS[Steam3Session]:::steam
        LIC_MGR[License Manager]:::steam
        CHARTS[Steam Charts Service]:::steam
    end

    subgraph Config
        SETTINGS[Settings]:::config
    end

    subgraph External
        STEAM_CDN[Steam CDN]:::external
        STEAM_AUTH[Steam Auth Services]:::external
        LANCACHE[Lancache Server]:::external
    end

    %% Relationships
    CLI_INT --> STEAM_MGR
    CLI_INT --> SETTINGS
    BENCH --> DOWN_MGR

    STEAM_MGR --> STEAM_INT
    STEAM_MGR --> DOWN_MGR
    
    STEAM_INT --> STEAM_SESS
    STEAM_INT --> LIC_MGR
    STEAM_INT --> CHARTS
    
    DOWN_MGR --> CDN_POOL
    CDN_POOL --> STEAM_CDN
    DOWN_MGR --> LANCACHE
    
    STEAM_SESS --> STEAM_AUTH
    
    APP_INFO --> STEAM_INT
    MAN_HAND --> STEAM_INT
    DEP_HAND --> STEAM_INT

    %% Click Events
    click CLI_INT "https://github.com/tpill90/steam-lancache-prefill/tree/master/SteamPrefill/CliCommands/"
    click BENCH "https://github.com/tpill90/steam-lancache-prefill/tree/master/SteamPrefill/CliCommands/Benchmark/"
    click STEAM_MGR "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/SteamManager.cs"
    click DOWN_MGR "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/Handlers/DownloadHandler.cs"
    click APP_INFO "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/Handlers/AppInfoHandler.cs"
    click MAN_HAND "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/Handlers/ManifestHandler.cs"
    click DEP_HAND "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/Handlers/DepotHandler.cs"
    click CDN_POOL "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/Handlers/Steam/CdnPool.cs"
    click STEAM_SESS "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/Handlers/Steam/Steam3Session.cs"
    click LIC_MGR "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/Handlers/Steam/LicenseManager.cs"
    click CHARTS "https://github.com/tpill90/steam-lancache-prefill/blob/master/SteamPrefill/Handlers/Steam/SteamChartsService.cs"
    click SETTINGS "https://github.com/tpill90/steam-lancache-prefill/tree/master/SteamPrefill/Settings/"

    %% Styles
    classDef core fill:#2374ab,stroke:#000,color:#fff
    classDef steam fill:#ffb703,stroke:#000,color:#000
    classDef external fill:#8ecae6,stroke:#000,color:#000
    classDef config fill:#grey,stroke:#000,color:#000
    classDef cli fill:#219ebc,stroke:#000,color:#fff

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Steam Integration]:::steam
        L3[External Services]:::external
        L4[Configuration]:::config
        L5[CLI Layer]:::cli
    end
```
