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

databendlabs / openraft / 19132305171
88%
main: 88%

Build:
Build:
LAST BUILD BRANCH: release-0.10
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.434% (+0.08%) from 91.359%
19132305171

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%)

1 existing line in 1 file now uncovered.

12777 of 13974 relevant lines covered (91.43%)

133918.99 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
81.47
-0.39% openraft/src/replication/mod.rs
Jobs
ID Job ID Ran Files Coverage
1 19132305171.1 06 Nov 2025 10:20AM UTC 214
91.43
GitHub Action Run
Source Files on build 19132305171
  • Tree
  • List 214
  • Changed 10
  • Source Changed 8
  • Coverage Changed 9
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #19132305171
  • cfcfc071 on github
  • Prev Build on main (#19128778756)
  • Next Build on release-0.10 (#19159141774)
  • 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