fix: correct critical bugs and improve pipe streaming performance
Critical bug fixes:
- save_item now returns real Item from database, not a hardcoded fake
- AsyncDataService::save() reuses self.sync_service instead of creating redundant instance
- GenerateStatus trait signature mismatch fixed (CLI/API decoupling)
Performance improvements (pipe path untouched):
- CompressionEngine::open() returns Box<dyn Read + Send> enabling true streaming
- mode_get eliminates triple full-file read (was sampling then re-reading entire file)
- FilteringReader adds fast-path bypass when no filters, pre-allocates temp buffer
- text.rs meta plugin processes &[u8] slice directly, eliminates data.to_vec() clone
API correctness:
- Tag parse errors now return 400 instead of being silently discarded
- compute_diff uses similar crate (LCS-based) instead of naive positional comparison
Cleanup:
- Modernize string formatting (format!({x})) across codebase
- Remove redundant DB query in get mode
- Derive Debug/ToSchema on public types
- Delete placeholder test files with no real assertions
- Extract parse_comma_tags utility function
This commit is contained in:
@@ -73,7 +73,7 @@ impl FilterPlugin for GrepFilter {
|
||||
for line in buf_reader.by_ref().lines() {
|
||||
let line = line?;
|
||||
if self.regex.is_match(&line) {
|
||||
writeln!(writer, "{}", line)?;
|
||||
writeln!(writer, "{line}")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -184,7 +184,7 @@ impl FilterPlugin for HeadLinesFilter {
|
||||
let mut buf_reader = std::io::BufReader::new(reader);
|
||||
for line in buf_reader.by_ref().lines() {
|
||||
let line = line?;
|
||||
writeln!(writer, "{}", line)?;
|
||||
writeln!(writer, "{line}")?;
|
||||
self.remaining -= 1;
|
||||
if self.remaining == 0 {
|
||||
break;
|
||||
|
||||
@@ -381,7 +381,7 @@ pub fn parse_filter_string(filter_str: &str) -> Result<FilterChain> {
|
||||
_ => {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::InvalidInput,
|
||||
format!("Filter '{}' requires parameters", part),
|
||||
format!("Filter '{part}' requires parameters"),
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -391,7 +391,7 @@ pub fn parse_filter_string(filter_str: &str) -> Result<FilterChain> {
|
||||
// If we get here, the filter wasn't recognized
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::InvalidInput,
|
||||
format!("Unknown filter: {}", part),
|
||||
format!("Unknown filter: {part}"),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ fn create_filter_with_options(
|
||||
if !option_defs.iter().any(|opt| &opt.name == key) {
|
||||
return Err(std::io::Error::new(
|
||||
std::io::ErrorKind::InvalidInput,
|
||||
format!("Unknown option '{}'", key),
|
||||
format!("Unknown option '{key}'"),
|
||||
));
|
||||
}
|
||||
options.insert(key.clone(), value.clone());
|
||||
|
||||
@@ -108,7 +108,7 @@ impl FilterPlugin for SkipLinesFilter {
|
||||
if self.remaining > 0 {
|
||||
self.remaining -= 1;
|
||||
} else {
|
||||
writeln!(writer, "{}", line)?;
|
||||
writeln!(writer, "{line}")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -127,7 +127,7 @@ impl FilterPlugin for TailLinesFilter {
|
||||
|
||||
// Write the buffered lines
|
||||
for line in &self.lines {
|
||||
writeln!(writer, "{}", line)?;
|
||||
writeln!(writer, "{line}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user