# fschaper/palo architecture

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

- Interactive diagram: https://gitdiagram.com/fschaper/palo
- Repository: https://github.com/fschaper/palo

## Overview

##### Project type and purpose
- This is a standalone C++‐based MOLAP server (“PALO 5.1”) that exposes a rich API over HTTP/HTTPS for multidimensional OLAP operations (cubes, dimensions, cells, rules, etc.).
- It is not a two-tier “front end + back end” web app but a monolithic server offering a programmable API and tool interfaces (e.g., PaloLoader, HTTP interface, AutosaveTimer).

##### File structure
- Top‐level directories:
- Api – API definition files and HTML/CSS/JS templates used to generate documentation and endpoint stubs
- Library – all core C++ modules, broken down into subpackages (Collections, Engine, Olap, HttpServer, HttpsServer, Parser, Scheduler, Worker, VirtualMachine, etc.)
- Programs – entry points (palo.cpp, palorun.cpp, PaloLoader, HTTP interface adapters, service wrapper)
- Config, Modules, Resource, CMakeLists.txt, Dockerfile, README, LICENSE, CHANGELOG
- Architectural patterns evident:
- Layered monolith: HTTP layer → Dispatch/Jobs → Worker/Engine layer → Storage/Cache layer
- Job queue / thread‐pool scheduling (Scheduler, Thread)
- Parser/Bytecode generation for rules (Parser, VirtualMachine)
- Separation of HTTP vs. HTTPS servers

##### README for additional insights
- Build system: CMake, supports Windows (VS2010 SP1) and Linux (gcc/g++, Boost, OpenSSL, ICU, Zlib, gperftools)
- The server executable (palo) binds to a port, serves requests, and persists data on disk

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Clients
    Client["API Consumer"]:::external

    %% External Libraries
    subgraph "External Dependencies"
        Boost["Boost"]:::external
        OpenSSL["OpenSSL"]:::external
        ICU["ICU"]:::external
        Zlib["Zlib"]:::external
    end

    %% Network Layer
    subgraph "Network Layer" 
        HttpServer["HttpServer"]:::network
        HttpsServer["HttpsServer"]:::network
        PaloHttpServer["PaloHttpServer"]:::network
        PaloHttpInterface["PaloHttpInterface"]:::network
    end

    %% Dispatch & Scheduler
    subgraph "Dispatch Layer"
        Dispatcher["Dispatcher"]:::dispatch
        Scheduler["Scheduler"]:::dispatch
        ThreadPool["Thread Pool"]:::dispatch
        MTPaloInterface["MTPaloInterface"]:::dispatch
    end

    %% Business Logic
    subgraph "Business Layer"
        Worker["Worker"]:::biz
        Engine["Engine"]:::biz
        Olap["Olap"]:::biz
    end

    %% Parser & VM
    subgraph "Parser & VM"
        Parser["Parser"]:::parser
        VM["VirtualMachine"]:::parser
    end

    %% Persistence Layer
    subgraph "Persistence Layer"
        IO["InputOutput"]:::persistence
        CubeStorage["CubeFileStream\n& StorageCpu"]:::persistence
    end

    %% Configuration & Licensing
    subgraph "Config & Licensing"
        Config["Config"]:::config
        Resource["Resource"]:::config
        LicenseException["LicenseException"]:::config
    end

    %% Entry Point Programs
    subgraph "Programs & Tools"
        PaloExe["palo.cpp"]:::program
        Palorun["palorun.cpp"]:::program
        PaloLoader["PaloLoader"]:::program
        AutosaveTimer["AutosaveTimer"]:::program
        WinService["Win32ServiceWrapper"]:::program
    end

    %% Flow Arrows
    Client -->|"HTTPS/TCP"| HttpServer
    Client -->|"HTTPS/TCP"| HttpsServer
    HttpServer --> PaloHttpInterface
    HttpsServer --> PaloHttpInterface
    PaloHttpInterface --> Dispatcher
    MTPaloInterface --> Dispatcher
    Dispatcher --> Scheduler
    Scheduler --> ThreadPool
    ThreadPool --> Worker
    Worker --> Engine
    Worker --> Olap
    Engine --> Parser
    Parser --> VM
    Engine --> IO
    IO --> CubeStorage
    Olap --> IO

    %% Return flow
    VM --> Worker
    CubeStorage --> Worker

    %% External deps usage
    HttpServer --> OpenSSL
    HttpsServer --> OpenSSL
    Parser --> ICU
    Engine --> Boost
    IO --> Zlib

    %% Click Events
    click HttpServer "https://github.com/fschaper/palo/tree/master/Library/HttpServer"
    click HttpsServer "https://github.com/fschaper/palo/tree/master/Library/HttpsServer"
    click PaloHttpServer "https://github.com/fschaper/palo/tree/master/Library/PaloHttpServer"
    click PaloHttpInterface "https://github.com/fschaper/palo/blob/master/Programs/PaloHttpInterface.cpp"
    click Dispatcher "https://github.com/fschaper/palo/tree/master/Library/Dispatcher"
    click Scheduler "https://github.com/fschaper/palo/tree/master/Library/Scheduler"
    click ThreadPool "https://github.com/fschaper/palo/tree/master/Library/Thread"
    click MTPaloInterface "https://github.com/fschaper/palo/blob/master/Programs/MTPaloInterface.cpp"
    click Worker "https://github.com/fschaper/palo/tree/master/Library/Worker"
    click Engine "https://github.com/fschaper/palo/tree/master/Library/Engine"
    click Olap "https://github.com/fschaper/palo/tree/master/Library/Olap"
    click Parser "https://github.com/fschaper/palo/tree/master/Library/Parser"
    click VM "https://github.com/fschaper/palo/tree/master/Library/VirtualMachine"
    click IO "https://github.com/fschaper/palo/tree/master/Library/InputOutput"
    click Config "https://github.com/fschaper/palo/tree/master/Config"
    click Resource "https://github.com/fschaper/palo/tree/master/Resource"
    click LicenseException "https://github.com/fschaper/palo/blob/master/Library/Exceptions/LicenseException.cpp"
    click PaloExe "https://github.com/fschaper/palo/blob/master/Programs/palo.cpp"
    click Palorun "https://github.com/fschaper/palo/blob/master/Programs/palorun.cpp"
    click PaloLoader "https://github.com/fschaper/palo/blob/master/Programs/PaloLoader.cpp"
    click AutosaveTimer "https://github.com/fschaper/palo/blob/master/Programs/AutosaveTimer.h"
    click WinService "https://github.com/fschaper/palo/blob/master/Programs/Win32ServiceWrapper.h"

    %% Styles
    classDef network fill:#D0E8FF,stroke:#005A9C,color:#005A9C
    classDef dispatch fill:#FFE7C1,stroke:#CC7A00,color:#CC7A00
    classDef biz fill:#D4F4DD,stroke:#2E7D32,color:#2E7D32
    classDef parser fill:#FDEBD0,stroke:#B9770E,color:#B9770E
    classDef persistence fill:#EEDFCC,stroke:#8B4513,color:#8B4513
    classDef config fill:#F0F0F0,stroke:#666666,color:#666666
    classDef program fill:#FFFFFF,stroke:#000000,color:#000000
    classDef external fill:#F5F5F5,stroke:#999999,color:#999999
```
