fix: Close the unclosed delimiter in the compression engine trait
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -122,6 +122,18 @@ pub trait CompressionEngine {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns status information for this compression engine.
|
||||||
|
///
|
||||||
|
/// For internal engines, returns ("<INTERNAL>", "", "").
|
||||||
|
/// For external program engines, returns (program_binary, compress_args, decompress_args).
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
///
|
||||||
|
/// A tuple of (binary, compress_command, decompress_command).
|
||||||
|
fn get_status_info(&self) -> (String, String, String) {
|
||||||
|
("<INTERNAL>".to_string(), "".to_string(), "".to_string())
|
||||||
|
}
|
||||||
|
|
||||||
/// Copies decompressed content from a file to a writer.
|
/// Copies decompressed content from a file to a writer.
|
||||||
///
|
///
|
||||||
/// Reads the compressed file and writes the decompressed content to the provided writer.
|
/// Reads the compressed file and writes the decompressed content to the provided writer.
|
||||||
@@ -144,3 +156,51 @@ pub trait CompressionEngine {
|
|||||||
writer.flush()?;
|
writer.flush()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref COMPRESSION_ENGINES: EnumMap<CompressionType, Box<dyn CompressionEngine>> = {
|
||||||
|
enum_map! {
|
||||||
|
CompressionType::LZ4 => Box::new(crate::compression_engine::lz4::CompressionEngineLZ4::new()),
|
||||||
|
CompressionType::GZip => {
|
||||||
|
#[cfg(feature = "gzip")]
|
||||||
|
Box::new(crate::compression_engine::gzip::CompressionEngineGZip::new()),
|
||||||
|
#[cfg(not(feature = "gzip"))]
|
||||||
|
Box::new(crate::compression_engine::program::CompressionEngineProgram::new(
|
||||||
|
"gzip",
|
||||||
|
vec!["-c"],
|
||||||
|
vec!["-d", "-c"]
|
||||||
|
))
|
||||||
|
},
|
||||||
|
CompressionType::BZip2 => Box::new(crate::compression_engine::program::CompressionEngineProgram::new(
|
||||||
|
"bzip2",
|
||||||
|
vec!["-c"],
|
||||||
|
vec!["-d", "-c"]
|
||||||
|
)),
|
||||||
|
CompressionType::XZ => Box::new(crate::compression_engine::program::CompressionEngineProgram::new(
|
||||||
|
"xz",
|
||||||
|
vec!["-c"],
|
||||||
|
vec!["-d", "-c"]
|
||||||
|
)),
|
||||||
|
CompressionType::ZStd => Box::new(crate::compression_engine::program::CompressionEngineProgram::new(
|
||||||
|
"zstd",
|
||||||
|
vec!["-c"],
|
||||||
|
vec!["-d", "-c"]
|
||||||
|
)),
|
||||||
|
CompressionType::None => Box::new(crate::compression_engine::none::CompressionEngineNone::new())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn default_compression_type() -> CompressionType {
|
||||||
|
CompressionType::LZ4
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_compression_engine(ct: CompressionType) -> Result<Box<dyn CompressionEngine>> {
|
||||||
|
let engine = &COMPRESSION_ENGINES[ct];
|
||||||
|
if engine.is_supported() {
|
||||||
|
Ok(engine.clone())
|
||||||
|
} else {
|
||||||
|
Err(anyhow!("Compression engine for {} is not supported", ct))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user