Skip to main content

reifydb_engine/bulk_insert/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4//! Fast path for inserting many rows at once. Skips the per-row VM dispatch loop, coerces and validates the input
5//! batch up front, and writes directly through the storage commit path so a load of a million rows pays a small
6//! constant overhead rather than a million instruction-dispatch costs.
7//!
8//! Used by ingestion endpoints, replication, and the bulk-load admin tool. Validation here matches the constraints
9//! the per-row INSERT path applies; if the two diverge, bulk-insert can accept rows that single-row INSERT would
10//! reject (or vice versa), which silently produces inconsistent state.
11
12pub mod builder;
13pub mod coerce;
14pub mod primitive;
15pub mod validation;
16
17#[derive(Debug, Clone, Default)]
18pub struct BulkInsertResult {
19	pub tables: Vec<TableInsertResult>,
20	pub ringbuffers: Vec<RingBufferInsertResult>,
21	pub series: Vec<SeriesInsertResult>,
22}
23
24#[derive(Debug, Clone)]
25pub struct TableInsertResult {
26	pub namespace: String,
27	pub table: String,
28	pub inserted: u64,
29}
30
31#[derive(Debug, Clone)]
32pub struct RingBufferInsertResult {
33	pub namespace: String,
34	pub ringbuffer: String,
35	pub inserted: u64,
36}
37
38#[derive(Debug, Clone)]
39pub struct SeriesInsertResult {
40	pub namespace: String,
41	pub series: String,
42	pub inserted: u64,
43}