• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

databendlabs / openraft / 19132305149
88%

Build:
DEFAULT BRANCH: main
Ran 06 Nov 2025 10:20AM UTC
Jobs 1
Files 214
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

06 Nov 2025 08:04AM UTC coverage: 91.391% (+0.03%) from 91.359%
19132305149

push

github

drmingdrmer
change: Migrate `RaftStateMachine::apply()` from Iterator to Stream

Update the `apply()` method signature to use `Stream` instead of `IntoIterator`
for better error handling and async streaming support:

- Change `IntoIterator<Item = EntryResponder<C>>` to
  `Stream<Item = Result<EntryResponder<C>, io::Error>>`
- All implementations now use `try_next().await?` for cleaner error handling
- Update all 10+ implementations across examples and benchmarks

Add leader-bounded streaming to `RaftLogReader`:
- New `leader_bounded_stream()` method that reads entries conditional on
  vote state, ensuring leader hasn't changed during iteration
- New `entries_stream()` method for unconditional streaming
- Add `LeaderChanged` and `LeaderBoundedStreamError` error types
- Add comprehensive test coverage for vote consistency checks

Benefits:
- Simpler error propagation with `try_next().await?` pattern
- Better support for async iteration and backpressure
- Safer log reading with leader change detection

- Fix: #1472

Upgrade tip:

For `RaftStateMachine::apply()` implementations:

```rust
// Before:
async fn apply<I>(&mut self, entries: I) -> Result<(), io::Error>
where
    I: IntoIterator<Item = EntryResponder<TypeConfig>> + Send,
    I::IntoIter: Send,
{
    for (entry, responder) in entries {
        // process entry
    }
    Ok(())
}

// After:
async fn apply<Strm>(&mut self, mut entries: Strm) -> Result<(), io::Error>
where Strm: Stream<Item = Result<EntryResponder<TypeConfig>, io::Error>> + Unpin + OptionalSend
{
    use futures::TryStreamExt;

    while let Some((entry, responder)) = entries.try_next().await? {
        // process entry
    }
    Ok(())
}
```

147 of 157 new or added lines in 7 files covered. (93.63%)

2 existing lines in 2 files now uncovered.

12771 of 13974 relevant lines covered (91.39%)

133078.07 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
4
89.19
-10.81% openraft/src/storage/v2/raft_log_reader.rs
6
50.0
openraft/src/error/leader_changed.rs

Uncovered Existing Lines

Lines Coverage ∆ File
1
82.09
0.0% openraft/src/metrics/serde_instant.rs
1
81.85
0.0% openraft/src/replication/mod.rs
Jobs
ID Job ID Ran Files Coverage
1 19132305149.1 06 Nov 2025 10:20AM UTC 214
91.39
GitHub Action Run
Source Files on build 19132305149
  • Tree
  • List 214
  • Changed 11
  • Source Changed 8
  • Coverage Changed 10
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #19132305149
  • cfcfc071 on github
  • Prev Build on main (#19128778756)
  • Next Build on main (#19133388770)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc