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

databendlabs / openraft / 15236981492
88%

Build:
DEFAULT BRANCH: main
Ran 25 May 2025 10:40AM UTC
Jobs 1
Files 191
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

25 May 2025 05:51AM UTC coverage: 90.34% (-0.09%) from 90.427%
15236981492

push

github

drmingdrmer
feat: add `Raft::get_read_linearizer()`

Add new API `Raft::get_read_linearizer()` to implement linearizable
reads. It provides a clearer API and gives users intuitive guidance
on how to perform local linearizable reads or follower reads, i.e.,
get `read_log_id` from a remote leader but read the local state machine.

`Raft::get_read_linearizer()` ensures leadership and returns a
`Linearizer` instance containing `read_log_id` and the last `applied`
log ID in the state machine. The caller, either on the local node or on
a remote follower, calls `Linearizer::await_applied()` to block until
the state machine applies up to `read_log_id` to assert linearizability.

A typical usage of follower read:

```rust,ignore
// Application defined RPC to get the `read_log_id` from the remote leader
let leader_id = my_raft.current_leader().await?.unwrap();
let linearizer = my_app_rpc.get_read_linearizer(leader_id, ReadPolicy::ReadIndex).await?;

// Block waiting local state machine to apply up to the `read_log_id`
let _ = linearizer.await_applied(&my_raft, None).await?.unwrap();

// Following read from state machine is linearized across the cluster
let val = my_raft.with_state_machine(|sm| { sm.read("foo") }).await?;
```

63 of 79 new or added lines in 7 files covered. (79.75%)

3 existing lines in 2 files now uncovered.

9838 of 10890 relevant lines covered (90.34%)

98008.38 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
96.15
-3.85% openraft/src/engine/handler/leader_handler/mod.rs
15
51.61
openraft/src/raft/linearizable_read/linearizer.rs

Uncovered Existing Lines

Lines Coverage ∆ File
1
74.05
-0.63% openraft/src/replication/mod.rs
2
94.29
-5.71% openraft/src/core/heartbeat/worker.rs
Jobs
ID Job ID Ran Files Coverage
1 15236981492.1 25 May 2025 10:40AM UTC 191
90.34
GitHub Action Run
Source Files on build 15236981492
  • Tree
  • List 191
  • Changed 11
  • Source Changed 9
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #15236981492
  • 467ffaa7 on github
  • Prev Build on release-0.10 (#15074256140)
  • Next Build on main (#15237453167)
  • 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