# leonoel/missionary architecture

> Architecture diagram of the GitHub repository leonoel/missionary, 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/leonoel/missionary
- Repository: https://github.com/leonoel/missionary

## Overview

##### Main Components

a) Core Processing Layer
- Task Processing Engine
- Flow Protocol Implementation
- Reactive Computation Engine

b) Protocol Implementation Layer
- Discrete Streams (for event handling)
- Continuous Signals (for time-varying values)
- IO Actions (for side effects)

c) Integration Layer
- Integration points with:
- Clojure Core Abstractions
- ClojureScript Runtime
- Reactive Streams Compatibility

##### Component Relationships

a) Data Flow
- How data flows from input sources through:
- Signal Processing → Continuous Time Handling
- Event Streams → Discrete Time Processing
- Effect System → IO Actions

b) Supervision Tree
- Hierarchical supervision structure:
- Parent-Child Process Relationships
- Error Propagation Paths
- Cancellation Flow

##### Implementation Details

- Dataflow Engine (src/missionary/impl/Dataflow.*)
- Fiber Management (src/missionary/impl/Fiber.*)
- Reactor System (src/missionary/impl/Reactor.*)

b) Protocol Implementations (Hexagons):
- Flow Protocol
- Reactive Streams Interface
- Reference Type Watchers

c) Utility Components (Rounded rectangles):
- Buffer Management
- Scheduling
- Resource Management

##### Output Layer (Effects, Streams, Signals)

Left to right organization:

##### Additional Elements

Callouts for:
- Backpressure mechanisms
- Lazy evaluation paths
- Resource cleanup flows
- Error handling paths

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Input Layer"
        Input1["Signals"]
        Input2["Events"]
        Input3["IO Actions"]
    end

    subgraph "Core Processing Layer"
        Core["Missionary Core"]:::core
        click Core "https://github.com/leonoel/missionary/blob/master/src/missionary/core.cljc"

        subgraph "Processing Engines"
            TaskEngine["Task Processing Engine"]
            FlowProto["Flow Protocol Implementation"]
            ReactiveEngine["Reactive Computation Engine"]
        end

        subgraph "Platform Implementations"
            direction TB
            JVM["JVM Implementation"]:::jvm
            click JVM "https://github.com/leonoel/missionary/tree/master/java/missionary/impl/"
            CLJS["ClojureScript Implementation"]:::cljs
            click CLJS "https://github.com/leonoel/missionary/tree/master/src/missionary/impl/"
        end
    end

    subgraph "Implementation Layer"
        direction TB
        DataFlow["Dataflow Engine"]:::impl
        click DataFlow "https://github.com/leonoel/missionary/blob/master/java/missionary/impl/Dataflow.java"
        
        FiberMgmt["Fiber Management"]:::impl
        click FiberMgmt "https://github.com/leonoel/missionary/blob/master/java/missionary/impl/Fiber.java"
        
        ReactorSys["Reactor System"]:::impl
        click ReactorSys "https://github.com/leonoel/missionary/blob/master/java/missionary/impl/Reactor.java"
        
        BufferMgmt["Buffer Management"]:::impl
        click BufferMgmt "https://github.com/leonoel/missionary/blob/master/java/missionary/impl/Buffer.java"
        
        ResourceMgmt["Resource Management"]:::impl
        click ResourceMgmt "https://github.com/leonoel/missionary/blob/master/java/missionary/impl/Util.java"
    end

    subgraph "Protocol Layer"
        ContSignals["Continuous Signals"]:::proto
        click ContSignals "https://github.com/leonoel/missionary/blob/master/java/missionary/impl/Continuous.java"
        
        DiscreteStreams["Discrete Streams"]:::proto
        click DiscreteStreams "https://github.com/leonoel/missionary/blob/master/java/missionary/impl/Event.java"
        
        IOActions["IO Actions"]:::proto
    end

    subgraph "Testing Infrastructure"
        TCK["TCK Integration"]:::test
        click TCK "https://github.com/leonoel/missionary/tree/master/tck/missionary/"
        
        FlowTest["Flow Protocol Testing"]:::test
        click FlowTest "https://github.com/leonoel/missionary/blob/master/test/missionary/core_test.cljc"
    end

    subgraph "Supervision & Control"
        Supervision["Supervision Tree"]
        ErrorHandling["Error Propagation"]
        Cancellation["Cancellation System"]:::control
        click Cancellation "https://github.com/leonoel/missionary/blob/master/java/missionary/Cancelled.java"
    end

    %% Relationships
    Input1 & Input2 & Input3 --> Core
    Core --> ProcessingEngines
    Core --> JVM & CLJS
    JVM & CLJS --> DataFlow & FiberMgmt & ReactorSys
    DataFlow & FiberMgmt & ReactorSys --> ContSignals & DiscreteStreams & IOActions
    Core --> Supervision
    Supervision --> ErrorHandling & Cancellation
    Core -.-> TCK & FlowTest

    %% Styles
    classDef core fill:#f9f,stroke:#333,stroke-width:2px
    classDef impl fill:#bbf,stroke:#333
    classDef proto fill:#bfb,stroke:#333
    classDef test fill:#ffb,stroke:#333
    classDef control fill:#fbb,stroke:#333
    classDef jvm fill:#ddf,stroke:#333
    classDef cljs fill:#fdd,stroke:#333

    %% Legend
    subgraph Legend
        L1["Core Component"]:::core
        L2["Implementation"]:::impl
        L3["Protocol"]:::proto
        L4["Testing"]:::test
        L5["Control Flow"]:::control
        L6["JVM Specific"]:::jvm
        L7["CLJS Specific"]:::cljs
    end
```
