Skip to main content

reifydb_core/testing/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4//! Capture types used by the test harness to record what happened during a run.
5//!
6//! `CapturedEvent` records each event the bus dispatched (sequence number, namespace, event family, variant, depth,
7//! captured columns); `CapturedInvocation` records each handler invocation (sequence, namespace, handler, event,
8//! variant, duration, outcome). `TestingChanged` is the marker emitted by handlers that opt in to test capture for a
9//! specific row-shape type. These structures are runtime-only; they are not persisted and never appear in normal
10//! operation.
11
12use crate::value::column::columns::Columns;
13
14#[derive(Clone, Debug)]
15pub struct CapturedEvent {
16	pub sequence: u64,
17	pub namespace: String,
18	pub event: String,
19	pub variant: String,
20	pub depth: u8,
21	pub columns: Columns,
22}
23
24#[derive(Clone, Debug)]
25pub struct CapturedInvocation {
26	pub sequence: u64,
27	pub namespace: String,
28	pub handler: String,
29	pub event: String,
30	pub variant: String,
31	pub duration_ns: u64,
32	pub outcome: String,
33	pub message: String,
34}
35
36pub struct TestingChanged {
37	pub shape_type: &'static str,
38}
39
40impl TestingChanged {
41	pub fn new(shape_type: &'static str) -> Self {
42		Self {
43			shape_type,
44		}
45	}
46}