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

databendlabs / openraft / 18972411689
88%

Build:
DEFAULT BRANCH: main
Ran 31 Oct 2025 12:27PM UTC
Jobs 1
Files 211
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

31 Oct 2025 12:22PM UTC coverage: 91.401% (-0.003%) from 91.404%
18972411689

push

github

drmingdrmer
change: storage traits return `io::Error`

Issue #1457: Simplify storage trait error API.

Benefits: Simpler trait implementation - Storage code doesn't need to
know about `StorageError<C>` or generic type parameters in error handling.

## Changes

Storage trait methods now return `io::Error` instead of `StorageError<C>`:
- `RaftLogStorage`: `append()`, `truncate()`, `purge()`, `save_vote()`, `save_committed()`
- `RaftLogReader`: `try_get_log_entries()`, `limited_get_log_entries()`, `read_vote()`, `get_key_log_ids()`
- `RaftStateMachine`: `applied_state()`, `apply()`, `get_current_snapshot()`, `begin_receiving_snapshot()`, `install_snapshot()`
- `RaftSnapshotBuilder`: `build_snapshot()`

Added internal `StorageIOResult` trait for error conversion:
- Provides 14 methods like `.sto_read_logs()`, `.sto_write_snapshot()`, etc.
- Converts `io::Error` to `StorageError<C>` with proper context at Openraft boundaries

- Fix: #1457

Upgrade tip:

Storage implementors should update trait methods to return `io::Error`:

```rust
// Before
async fn read_vote(&mut self) -> Result<Option<Vote>, StorageError<C>> {
    self.vote.read().map_err(|e| StorageError::read_vote(&e))
}

// After
async fn read_vote(&mut self) -> Result<Option<Vote>, io::Error> {
    self.vote.read()
}
```

Return `io::Error` directly - Openraft adds context automatically.
The method body may leave unchanged: `io::Error` can be converted to
`StorageError` with a simple `?`.

143 of 165 new or added lines in 13 files covered. (86.67%)

12405 of 13572 relevant lines covered (91.4%)

136635.12 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
77.62
0.73% openraft/src/network/snapshot_transport.rs
1
97.62
-0.02% openraft/src/testing/log/suite.rs
2
0.0
0.0% openraft/src/storage/v2/raft_log_storage.rs
3
96.25
-0.02% stores/memstore/src/lib.rs
15
64.29
openraft/src/error/storage_io_result.rs
Jobs
ID Job ID Ran Files Coverage
1 18972411689.1 31 Oct 2025 12:27PM UTC 211
91.4
GitHub Action Run
Source Files on build 18972411689
  • Tree
  • List 211
  • Changed 15
  • Source Changed 14
  • Coverage Changed 14
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #18972411689
  • d1ffaa2d on github
  • Prev Build on main (#18949917333)
  • Next Build on main (#18974885649)
  • 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