Skip to content

Refactor shuttle into modular crates #249

@jorajeev

Description

@jorajeev

We should refactor shuttle into a modular structure. Currently, the core runtime, schedulers, standard library primitives, and test utilities are all bundled together. Separating these would make it easier to add support for new libraries (like tokio and parking_lot), improve maintainability, and provide a minimal core focused on tracking dependencies via vector clocks and exposing foundational primitives for building custom synchronization constructs (like atomic-wait requested in #248 ).

We've already started doing this with shuttle-tokio (#238) and shuttle-parking_lot (#232)

Here's a proposed crate structure we could consider (credit due to @sarsko and @Aurel300 who came up with most of this):

  • shuttle-core

    • trait Scheduler
      • do we need dfs here too, for running tests for shuttle-core ?
    • Runtime, execution state, vector clocks
    • a core primitive that all other primitives (like Mutex, mpsc channels etc) can be built on top of
      • currently, this is BatchSemaphore, but we should consider making an even more foundational primitive that is smaller, easier to maintain, and supports building things like atomic-wait
  • shuttle-schedulers

    • put all the specific schedulers here (Random, Pct, URW, ...)
  • shuttle-sync

    • all the std::sync replacement primitives
  • specific libraries that need Shuttle replacements, following the shuttle-tokio pattern designed by @sarsko

  • main shuttle entry point

    • re-export for convenience and backward compatibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions