spectroscope 0.1.0

Consistency and isolation level checkers for distributed systems testing
Documentation
  • Coverage
  • 69.07%
    67 out of 97 items documented1 out of 44 items with examples
  • Size
  • Source code size: 115.56 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.99 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 28s Average build duration of successful builds.
  • all releases: 28s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • pcholakov/spectroscope
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • pcholakov

Spectroscope

Consistency checkers for distributed systems testing.

Spectroscope verifies that operation histories from distributed systems conform to expected consistency models. This is a port of Jepsen's set-full workload linearizability checker.

Installation

[dependencies]
spectroscope = "0.1"

Usage

use spectroscope::history::{History, Op, Pid};
use spectroscope::set_full::{SetFullChecker, Validity};

// Workload set value type
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
struct Val(u32);

// Build a history of operations from your distributed system
let mut history = History::new();

// Process 0 adds element 1
history.push(Op::add_invoke(0, Pid(0), Val(1)).at_millis(0));
history.push(Op::add_ok(1, Pid(0), Val(1)).at_millis(5));
//                      ^  ^^^^^^  ^^^^^^  ^^^^^^^^^^^^
//                      |  |       |       timestamp relative to test start
//                      |  |       value being added
//                      |  process id
//                      operation index

// Process 1 reads and sees the element
history.push(Op::read_invoke(2, Pid(1)).at_millis(10));
history.push(Op::read_ok(3, Pid(1), [Val(1)]).at_millis(12));

// Check the history for consistency violations
let result = SetFullChecker::default().check(&history);

assert_eq!(result.valid, Validity::Valid);
assert_eq!(result.stable_count, 1);        // 1 element confirmed visible
assert_eq!(result.lost_count, 0);          // no elements lost

What it checks

The set-full checker tracks elements through add and read operations:

  • Stable: Element is visible in all reads after being added
  • Lost: Element was confirmed added but later disappeared
  • Stale: Element took multiple reads to become visible (non-linearizable)
  • Never-read: Element was added but no subsequent reads occurred

A history is valid if no elements are lost (and no stale elements when linearizable mode is enabled).

Linearizable mode

For strict linearizability, elements must appear immediately after being added:

let checker = SetFullChecker::linearizable();
let result = checker.check(&history);
// Fails if any element has non-zero visibility latency

License

EPL-1.0