Skip to content

systems session store

Douwe de Vries edited this page Jul 2, 2026 · 1 revision

Session store

Active contributors: Douwe de Vries

Purpose

The session store keeps loaded CSVs, column metadata, suggested mappings, comparison config, and results in memory. It is shared by the local web server and desktop wrapper.

Directory layout

src/backend/
├── store.rs
└── session.rs
src/api/state.rs

Key abstractions

Name File Description
SessionStore src/backend/store.rs Thread-safe in-memory store with eviction.
SessionData src/backend/session.rs Per-session data model.
data_revision src/backend/session.rs Monotonic marker used to reject stale writes.
AppState src/api/state.rs Axum-facing cloneable state wrapper.

How it works

SessionStore wraps a HashMap and insertion order queue behind parking_lot::RwLock. It evicts idle sessions, limits session count, and evicts least-recently-accessed sessions when total estimated bytes exceed the configured budget.

graph TD
    Create[create session] --> Store[SessionStore]
    Load[load CSV] --> Session[SessionData]
    Compare[run comparison] --> Revision[data_revision check]
    Revision --> Results[store results]
    Store --> Evict[idle/count/byte eviction]
Loading

Integration points

src/api/state.rs creates the HTTP-facing state. src-tauri/src/main.rs manages an Arc<SessionStore> for desktop commands. src/backend/workflow.rs is the main caller of with_session and with_session_mut.

Entry points for modification

Change session capacity or eviction behavior in src/backend/store.rs. Change stored workflow state in src/backend/session.rs, then update snapshot, export, and response tests if the data affects persistence.

Key source files

File Purpose
src/backend/store.rs Store creation, session CRUD, eviction, byte estimation.
src/backend/session.rs Stored session fields and estimated size helpers.
src/api/state.rs Axum state wrapper and session helpers.
src-tauri/src/main.rs Desktop SessionStore registration.

Clone this wiki locally