-
Notifications
You must be signed in to change notification settings - Fork 0
systems tauri backend
Active contributors: Douwe de Vries
The Tauri backend owns file import, runtime validation, smoke tests, k6 process lifecycle, report export, and shared run state. It exposes commands registered in src-tauri/src/lib.rs.
src-tauri/src/lib.rs
src-tauri/src/main.rs
src-tauri/src/models.rs
src-tauri/src/state.rs
src-tauri/src/events.rs
src-tauri/src/commands/
src-tauri/src/importing/
src-tauri/src/k6/
| Abstraction | File | Description |
|---|---|---|
SharedAppState |
src-tauri/src/state.rs |
Arc<Mutex<AppState>> shared by all commands and runtime tasks |
AppState |
src-tauri/src/state.rs |
Generated script, runtime collection, latest metrics/result, latest output, and active process |
RunningTest |
src-tauri/src/state.rs |
Active child process, run ID, and stop flag |
| Command modules | src-tauri/src/commands/ |
Tauri command handlers for collection and testing flows |
| Event emitters | src-tauri/src/events.rs |
Emits k6 output, metrics, completion, and errors to the main window |
src-tauri/src/lib.rs initializes shared state, dialog plugin, debug logging, startup cleanup for stale k6 temp artifacts, and command handlers. Collection import stores a generated script and runtime collection. Test commands validate state, reserve a run, start k6, stop k6, return status, smoke test requests, or export the latest report.
graph LR
Builder[Tauri builder] --> State[SharedAppState]
Builder --> Plugins[Dialog + debug log]
Builder --> Cleanup[Startup artifact cleanup]
Builder --> Commands[Command handlers]
Commands --> Importing[Importing module]
Commands --> K6[k6 module]
K6 --> Events[Window events]
The backend receives calls from Command API bridge. The k6 execution details are in k6 runtime, and report behavior is in Results and reporting.
Add commands in src-tauri/src/commands/ and register them in src-tauri/src/lib.rs. Add shared payload fields to both src-tauri/src/models.rs and src/lib/loadrift/types.ts.
| File | Purpose |
|---|---|
src-tauri/src/lib.rs |
Tauri builder setup and command registration |
src-tauri/src/models.rs |
Serialized command/event models |
src-tauri/src/state.rs |
Shared backend state |
src-tauri/src/events.rs |
Tauri event emitters |
src-tauri/src/commands/testing/mod.rs |
Test command handlers |