Skip to content

Refactor facade to UI to go through a single trait#241

Merged
ifd3f merged 11 commits into
mainfrom
refactor/orchestrator
May 5, 2026
Merged

Refactor facade to UI to go through a single trait#241
ifd3f merged 11 commits into
mainfrom
refactor/orchestrator

Conversation

@ifd3f

@ifd3f ifd3f commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary

This PR creates an Orchestrator trait, a facade that all UI implementations are expected to go through from now on.

The Orchestrator handles everything non-UI related and exposes convenient methods for UI implementations to bind against:

  • spawning child processes and escalating them
  • orchestrating multi-step workflows, such as write + verify
  • state reduction (i.e. turning event streams from the child processes, representing deltas, into WriterState objects, representing point-in-time snapshots and histories)
  • exposing handles for UI implementations to query reduced state with

This also refactors some of the simple and fancy TUIs' logic to use the Orchestrator.

Although we do intend to make our UIs sync later, probably including egui, all methods on the Orchestrator are async. The idea is that async is the environment for scheduling, and sync as the environment for rendering, so the UI implementations should bridge between sync and async by spawning bridge workers on the async runtime that communicate with the UI threads.

@sermuns: I'd appreciate your feedback on the Orchestrator API (in src/orchestrator/mod.rs), since you're currently implementing the UI in #240. Does it seem like a reasonable API, and is there anything else you'd think would be good to expose?

What's missing

  • We're not fully getting rid of HerderFacade just yet. As much of a shitty mess as it is, fully getting rid of it in this PR will duplicate a lot of work that the stdiomux changes already handle. For the time being, it's been demoted into a private module under orchestrator so that nothing else can see it.
  • Hashing: I'll want to make hashing go through the orchestrator as well, so that you can run hashing threads in the background. However, some more UI refactors will be needed before we put it in.
  • Also, OrchestratorImpl itself is a bit of a mess, once again because we aren't getting rid of HerderFacade yet.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • This change requires a documentation update
  • This change contains modifications to the --help output
    • I ran scripts/regenerate_readme.py from the root directory to ensure it has the latest sample output

Test plan

Ran inside the devvm, as sudo and non-sudo, and ensured that escalation doesn't fail and that disks still get written

@sermuns sermuns mentioned this pull request May 5, 2026
@ifd3f ifd3f merged commit 851882d into main May 5, 2026
36 checks passed
@ifd3f ifd3f deleted the refactor/orchestrator branch May 5, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant