1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Pipeline - the composable data loading engine.
//!
//! A pipeline is a chain: `Source -> [Workers] -> [Collector] -> Consumer`.
//! Multiple worker threads load data and apply stateless transforms in parallel.
//! A single collector thread applies ordering-sensitive stages such as shuffle,
//! batching, and collation.
//!
//! # Threading Model
//!
//! ```text
//! ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────┐
//! │ Source Thread│────▶│Worker Threads│────▶│Collector │────▶│ Consumer │
//! │ (1 thread) │ │ (N parallel) │ │Thread (1) │ │ (caller) │
//! └──────────────┘ └──────────────┘ └──────────────┘ └──────────┘
//! │ │ │
//! ▼ ▼ ▼
//! File I/O, CPU-bound Ordering-sensitive
//! network transforms (shuffle, batch)
//! ```
//!
//! # Configuration
//!
//! Use [`Pipeline`] builder methods to customize:
//!
//! ```rust
//! use tenshift_core::Pipeline;
//! use tenshift_core::sources::MemorySource;
//! use tenshift_core::sample::Sample;
//!
//! let pipeline = Pipeline::from_source(MemorySource::new("demo", Vec::<Sample>::new()))
//! .workers(4) // Number of parallel worker threads
//! .prefetch(8) // Items to prefetch (see auto-scaling docs)
//! .batch(32) // Batch size for collation
//! .shuffle(1000); // Shuffle buffer size
//! ```
//!
//! See the [crate-level documentation](crate) for detailed auto-scaling defaults.
pub use Pipeline;
pub use CollateMode;
pub use *;
pub use ;
pub use *;
pub use *;
pub use ;
pub use *;
pub use *;