exarch_core/extraction/engine.rs
1//! Core extraction engine.
2
3use std::path::Path;
4
5use crate::ExtractionReport;
6use crate::Result;
7use crate::SecurityConfig;
8
9/// Main extraction engine.
10pub struct ExtractionEngine {
11 #[allow(dead_code)]
12 config: SecurityConfig,
13}
14
15impl ExtractionEngine {
16 /// Creates a new extraction engine with the given configuration.
17 #[must_use]
18 pub fn new(config: SecurityConfig) -> Self {
19 Self { config }
20 }
21
22 /// Extracts an archive to the specified directory.
23 ///
24 /// # Errors
25 ///
26 /// Returns an error if extraction fails or security checks are violated.
27 pub fn extract(
28 &mut self,
29 _archive_path: &Path,
30 _output_dir: &Path,
31 ) -> Result<ExtractionReport> {
32 // Note: Extraction is handled directly by format-specific implementations
33 // (TarArchive::extract and ZipArchive::extract) to avoid unnecessary
34 // abstraction. This module remains as a potential future extension
35 // point for streaming extraction.
36 Ok(ExtractionReport::new())
37 }
38}
39
40#[cfg(test)]
41mod tests {
42 use super::*;
43
44 #[test]
45 fn test_extraction_engine_new() {
46 let config = SecurityConfig::default();
47 let _engine = ExtractionEngine::new(config);
48 }
49}