OxL Reference

fn replicaReads

How many reads this process has served from a replica instead of the leader (diagnostics; Follower and Stale reads of a clustered store on a node that holds a replica of the shard).

Example:

oxl✓ checked in CI
use std.kv { Kv, Consistency, replicaReads }
use std.core { Utf8 }

fn main() io, db {
  let kv = Kv.open("example-replica-reads")!
  kv.put("k", Utf8.encode("v"))!
  let fast = kv.reading(.Follower)
  print("{fast.get("k") is none}")
  // outside a cluster there is no replica to read from: the leader path serves it
  print("{replicaReads()}")
  kv.close()
}
Output
false
0
pub(api) fn replicaReads() -> i64

Since. 1.0.0-beta

Returns

i64

Effects

none declared (pure unless the body says otherwise)

Defined in: std/kv/kv.oxl:296

See also