Skip to main content

reifydb_core/testing/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 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 reifydb_value::value::duration::Duration;
13
14use crate::value::column::columns::Columns;
15
16#[derive(Clone, Debug)]
17pub struct CapturedEvent {
18	pub sequence: u64,
19	pub namespace: String,
20	pub event: String,
21	pub variant: String,
22	pub depth: u8,
23	pub columns: Columns,
24}
25
26#[derive(Clone, Debug)]
27pub struct CapturedInvocation {
28	pub sequence: u64,
29	pub namespace: String,
30	pub handler: String,
31	pub event: String,
32	pub variant: String,
33	pub duration: Duration,
34	pub outcome: String,
35	pub message: String,
36}
37
38pub struct TestingChanged {
39	pub object_type: &'static str,
40}
41
42impl TestingChanged {
43	pub fn new(object_type: &'static str) -> Self {
44		Self {
45			object_type,
46		}
47	}
48}