paritytech / paritytech/web3-storage

Deduplicate coordinator run-loops into a shared actor abstraction

Open
#315 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
13
Forks
3
Avg merge
2d 2h
Merged PRs (30d)
33

Description

The challenge responder and replica-sync coordinator (and for now the checkpoint coordinator) share the same run-loop scaffolding: a start() that spawns the loop and hands back a command handle, a biased tokio::select! over command/event/interval arms, pause/stop command handling, the events_open disarm for a closed broadcast channel, Lagged → bootstrap-rescan recovery, and the safety-net interval. Only the duty-specific behavior differs.

Raised by @bkontur in https://github.com/paritytech/web3-storage/pull/291#discussion_r3638194942: extract the shared scaffolding into a common trait Coordinator/actor abstraction that owns the tokio/channel/restart handling (including what happens when a coordinator task dies or panics), with per-impl hooks for the relevance filter, event reaction, bootstrap scan, and tick action — without pulling in an actor framework.

Sequencing: this should land after #311 (which removes the checkpoint coordinator, shrinking the surface to two loops) and after #297 (stacked on #291), so the refactor doesn't churn under both.

Relates to #291.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading #311 and #297, then compare the challenge responder and replica-sync coordinator run loops after those changes land. Identify the shared start, tokio::select!, channel-recovery, pause/stop, restart, and interval behavior, and define hooks for each coordinator's differing actions. Done means both remaining coordinators use one abstraction without an actor framework.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, distributed-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.