fix: resolve private field access and type issues

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-25 21:09:13 -03:00
parent 3611c93a4a
commit 9f140923bc
4 changed files with 15 additions and 7 deletions

View File

@@ -54,7 +54,7 @@ pub fn mode_get(
} }
// Use streaming approach to handle large files // Use streaming approach to handle large files
let mut reader = item_service.compression_service.stream_item_content( let mut reader = item_service.get_compression_service().stream_item_content(
data_path.join(item_id.to_string()), data_path.join(item_id.to_string()),
&item_with_meta.item.compression &item_with_meta.item.compression
)?; )?;
@@ -69,7 +69,7 @@ pub fn mode_get(
)); ));
} }
// We need to create a new reader since we consumed some bytes // We need to create a new reader since we consumed some bytes
reader = item_service.compression_service.stream_item_content( reader = item_service.get_compression_service().stream_item_content(
data_path.join(item_id.to_string()), data_path.join(item_id.to_string()),
&item_with_meta.item.compression &item_with_meta.item.compression
)?; )?;

View File

@@ -177,10 +177,10 @@ impl AsyncItemService {
let item_with_meta = item_service.get_item(&conn, item_id)?; let item_with_meta = item_service.get_item(&conn, item_id)?;
let item_id_val = item_with_meta.item.id.ok_or_else(|| CoreError::InvalidInput("Item missing ID".to_string()))?; let item_id_val = item_with_meta.item.id.ok_or_else(|| CoreError::InvalidInput("Item missing ID".to_string()))?;
let mut item_path = item_service.data_path.clone(); let mut item_path = item_service.get_data_path().clone();
item_path.push(item_id_val.to_string()); item_path.push(item_id_val.to_string());
let reader = item_service.compression_service.stream_item_content( let reader = item_service.get_compression_service().stream_item_content(
item_path, item_path,
&item_with_meta.item.compression &item_with_meta.item.compression
)?; )?;

View File

@@ -37,7 +37,7 @@ impl CompressionService {
let reader = engine.open(item_path.clone()) let reader = engine.open(item_path.clone())
.map_err(|e| CoreError::Other(anyhow!("Failed to open item file {:?}: {}", item_path, e)))?; .map_err(|e| CoreError::Other(anyhow!("Failed to open item file {:?}: {}", item_path, e)))?;
Ok(reader) Ok(Box::new(reader))
} }
} }

View File

@@ -100,7 +100,7 @@ impl ItemService {
let mut item_path = self.data_path.clone(); let mut item_path = self.data_path.clone();
item_path.push(item_id.to_string()); item_path.push(item_id.to_string());
let reader = self.compression_service.stream_item_content(item_path, &item_with_meta.item.compression)?; let reader = self.compression_service.stream_item_content(item_path.clone(), &item_with_meta.item.compression)?;
let metadata = item_with_meta.meta_as_map(); let metadata = item_with_meta.meta_as_map();
let mime_type = metadata let mime_type = metadata
@@ -114,7 +114,7 @@ impl ItemService {
} else { } else {
// Read only the first 8192 bytes for binary detection // Read only the first 8192 bytes for binary detection
let mut sample_reader = self.compression_service.stream_item_content( let mut sample_reader = self.compression_service.stream_item_content(
item_path.clone(), item_path,
&item_with_meta.item.compression &item_with_meta.item.compression
)?; )?;
let mut sample_buffer = vec![0; 8192]; let mut sample_buffer = vec![0; 8192];
@@ -376,4 +376,12 @@ impl ItemService {
self.get_item(conn, item_id) self.get_item(conn, item_id)
} }
pub fn get_compression_service(&self) -> &CompressionService {
&self.compression_service
}
pub fn get_data_path(&self) -> &PathBuf {
&self.data_path
}
} }