Skip to main content

Crate spectroscope

Crate spectroscope 

Source
Expand description

Consistency checkers for distributed systems testing.

Spectroscope verifies that operation histories from distributed systems conform to expected consistency models. Currently implements a set linearizability checker derived from Jepsen.

§Quick Start

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

let mut history = History::new();

// Process 0 adds element 1
history.push(Op::add_invoke(0, Pid(0), 1).at_millis(0));
history.push(Op::add_ok(1, Pid(0), 1).at_millis(5));

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

let result = SetFullChecker::default().check(&history);
assert_eq!(result.valid, Validity::Valid);

§Set-Full Checker

The SetFullChecker analyzes histories of set operations (add elements, read the set) and determines whether elements were properly persisted:

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

Use SetFullChecker::linearizable() for strict linearizability checking where elements must appear immediately after being added.

Re-exports§

pub use history::History;
pub use history::Op;
pub use history::OpFn;
pub use history::OpType;
pub use history::OpValue;
pub use history::Pid;
pub use history::Timestamp;
pub use set_full::ElementOutcome;
pub use set_full::SetFullChecker;
pub use set_full::SetFullOptions;
pub use set_full::SetFullResult;
pub use set_full::Validity;
pub use set_full::WorstStaleEntry;

Modules§

history
History representation for consistency checking.
set_full
Set-full linearizability checker.