ddex_parser/streaming/
mod.rs

1// src/streaming/mod.rs
2//! High-performance streaming DDEX parser implementation
3
4pub mod aligned_comprehensive;
5pub mod comprehensive;
6pub mod element;
7pub mod fast_streaming_parser;
8pub mod fast_zero_copy;
9pub mod fixed_comprehensive;
10pub mod iterator;
11pub mod minimal;
12pub mod parallel_parser;
13pub mod parser;
14pub mod state;
15pub mod verification;
16pub mod working_impl;
17pub mod zero_copy_parser;
18
19#[cfg(test)]
20pub mod comprehensive_tests;
21
22#[cfg(test)]
23pub mod debug_test;
24
25#[cfg(test)]
26pub mod perf_analysis;
27
28#[cfg(test)]
29pub mod zero_copy_benchmark;
30
31#[cfg(test)]
32pub mod parallel_benchmark;
33
34#[cfg(test)]
35pub mod consistency_test;
36
37pub use element::ParsedElement;
38pub use fast_streaming_parser::{
39    create_fast_parser, FastElementType, FastParsingStats, FastStreamingElement,
40    FastStreamingIterator, FastStreamingParser,
41};
42pub use fast_zero_copy::{FastZeroCopyIterator, FastZeroCopyParser};
43pub use iterator::DDEXStreamIterator;
44pub use parallel_parser::{ParallelBenchmark, ParallelStreamingIterator, ParallelStreamingParser};
45pub use parser::StreamingDDEXParser;
46pub use state::{ParserState, ParsingContext};
47pub use working_impl::{
48    WorkingStreamIterator, WorkingStreamingElement, WorkingStreamingParser, WorkingStreamingStats,
49};
50pub use zero_copy_parser::{ZeroCopyElement, ZeroCopyParser, ZeroCopyStreamIterator};
51
52use crate::parser::security::SecurityConfig;
53
54/// Configuration for streaming parser
55#[derive(Debug, Clone)]
56pub struct StreamingConfig {
57    /// Security configuration
58    pub security: SecurityConfig,
59    /// Buffer size for XML reading
60    pub buffer_size: usize,
61    /// Maximum memory usage before yielding elements
62    pub max_memory: usize,
63    /// Chunk size for processing
64    pub chunk_size: usize,
65    /// Enable progress callbacks
66    pub enable_progress: bool,
67    /// Progress callback interval (bytes)
68    pub progress_interval: u64,
69}
70
71impl Default for StreamingConfig {
72    fn default() -> Self {
73        Self {
74            security: SecurityConfig::default(),
75            buffer_size: 8192,
76            max_memory: 100 * 1024 * 1024, // 100MB
77            chunk_size: 100,
78            enable_progress: false,
79            progress_interval: 1024 * 1024, // 1MB
80        }
81    }
82}
83
84/// Progress information for streaming parsing
85#[derive(Debug, Clone)]
86pub struct StreamingProgress {
87    pub bytes_processed: u64,
88    pub elements_parsed: usize,
89    pub releases_parsed: usize,
90    pub resources_parsed: usize,
91    pub parties_parsed: usize,
92    pub deals_parsed: usize,
93    pub elapsed: std::time::Duration,
94    pub estimated_total_bytes: Option<u64>,
95    pub current_depth: usize,
96    pub memory_usage: usize,
97}