# lokad/azureeventstore architecture

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

- Interactive diagram: https://gitdiagram.com/lokad/azureeventstore
- Repository: https://github.com/lokad/azureeventstore

## Overview

##### Component Relationships

- Double lines: Data persistence

**[Event Creation] → [Transaction] → [Event Stream] → [Storage Driver] → [Azure Blob]**

**[Storage] → [Event Stream] → [Projection] → [State] → [Cache]**

**[IStorageDriver]**
- AzureStorageDriver
- FileStorageDriver
- MemoryStorageDriver
- CacheStorageDriver

##### Technical Details to Highlight

- JSON serialization with Json.NET
- Azure Append Blob integration
- Checksum verification system
- Snapshot management
- Thread-safety mechanisms

##### Integration Points

External system connections:
- Azure Blob Storage
- Application integration points
- Monitoring/logging interfaces

- Simplicity of architecture
- Robust data storage
- No-server design
- Thread-safety
- Consistency guarantees
- Projection state management

This design should reflect the library's focus on being a simple, low-maintenance solution while highlighting its robust event sourcing capabilities and Azure integration.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Application["Application Layer"]
        ESS["EventStreamService"]
        ESC["EventStreamConfig"]
    end

    subgraph Core["Core Processing Layer"]
        ESW["EventStreamWrapper"]
        TXN["Transaction"]
        APP["Append"]
    end

    subgraph Projection["Projection System"]
        RP["ReifiedProjection"]
        RPG["ReifiedProjectionGroup"]
        IP["IProjection"]
    end

    subgraph Stream["Stream Access Layer"]
        ES["EventStream"]
        IES["IEventStream"]
        BS["BoundedStream"]
        JES["JsonEventSerializer"]
        MS["MigrationStream"]
    end

    subgraph Storage["Storage Layer"]
        direction TB
        ISD["IStorageDriver"]
        ASD["AzureStorageDriver"]
        FSD["FileStorageDriver"]
        MSD["MemoryStorageDriver"]
        CSD["CacheStorageDriver"]
    end

    subgraph State["State Management"]
        SL["SnapshotList"]
        SM["SnapshotMap"]
        SCC["StateCreationContext"]
        SUC["StateUpkeepContext"]
    end

    subgraph Quarantine["Quarantine System"]
        EQ["EventQuarantine"]
        QE["QuarantinedEvent"]
    end

    %% Relationships
    Application --> Core
    Core --> Projection
    Core --> Stream
    Stream --> Storage
    Core --> State
    Stream --> Quarantine
    
    %% Storage Driver Relationships
    ISD --> ASD
    ISD --> FSD
    ISD --> MSD
    ISD --> CSD

    %% Click Events
    click ESS "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/EventStreamService.cs"
    click ESC "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/EventStreamConfig.cs"
    click ESW "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Wrapper/EventStreamWrapper.cs"
    click TXN "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Wrapper/Transaction.cs"
    click APP "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Wrapper/Append.cs"
    click RP "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Projections/ReifiedProjection.cs"
    click RPG "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Projections/ReifiedProjectionGroup.cs"
    click IP "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Projections/IProjection.cs"
    click ES "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Streams/EventStream.cs"
    click IES "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Streams/IEventStream.cs"
    click BS "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Streams/BoundedStream.cs"
    click JES "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Streams/JsonEventSerializer.cs"
    click MS "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Streams/MigrationStream.cs"
    click ISD "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Drivers/IStorageDriver.cs"
    click ASD "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Drivers/AzureStorageDriver.cs"
    click FSD "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Drivers/FileStorageDriver.cs"
    click MSD "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Drivers/MemoryStorageDriver.cs"
    click CSD "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Drivers/CacheStorageDriver.cs"
    click SL "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/State/SnapshotList.cs"
    click SM "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/State/SnapshotMap.cs"
    click SCC "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/StateCreationContext.cs"
    click SUC "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/StateUpkeepContext.cs"
    click EQ "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Quarantine/EventQuarantine.cs"
    click QE "https://github.com/Lokad/AzureEventStore/blob/master/Lokad.AzureEventStore/Quarantine/QuarantinedEvent.cs"

    %% Styling
    classDef application fill:#f9f,stroke:#333,stroke-width:2px
    classDef core fill:#bbf,stroke:#333,stroke-width:2px
    classDef projection fill:#fbf,stroke:#333,stroke-width:2px
    classDef stream fill:#bfb,stroke:#333,stroke-width:2px
    classDef storage fill:#ffb,stroke:#333,stroke-width:2px
    classDef state fill:#bff,stroke:#333,stroke-width:2px
    classDef quarantine fill:#fbb,stroke:#333,stroke-width:2px

    class ESS,ESC application
    class ESW,TXN,APP core
    class RP,RPG,IP projection
    class ES,IES,BS,JES,MS stream
    class ISD,ASD,FSD,MSD,CSD storage
    class SL,SM,SCC,SUC state
    class EQ,QE quarantine
```
