refactor: update response types to MetaPluginResponse

Co-authored-by: aider (openai/andrew/openrouter/mistralai/mistral-medium-3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-26 16:17:34 -03:00
parent ec5fde2771
commit a0fcb86fce
2 changed files with 13 additions and 13 deletions

View File

@@ -58,12 +58,12 @@ impl MetaPlugin for DigestSha256MetaPlugin {
true
}
fn initialize(&mut self, item_id: i64) -> Result<PluginResponse> {
fn initialize(&mut self, item_id: i64) -> Result<MetaPluginResponse> {
self.item_id = Some(item_id);
Ok(PluginResponse::default())
Ok(MetaPluginResponse::default())
}
fn finalize(&mut self) -> Result<PluginResponse> {
fn finalize(&mut self) -> Result<MetaPluginResponse> {
let mut metadata = Vec::new();
if let Some(item_id) = self.item_id {
@@ -77,15 +77,15 @@ impl MetaPlugin for DigestSha256MetaPlugin {
}
}
Ok(PluginResponse {
Ok(MetaPluginResponse {
metadata: Some(metadata),
is_finalized: true,
})
}
fn update(&mut self, data: &[u8]) -> Result<PluginResponse> {
fn update(&mut self, data: &[u8]) -> Result<MetaPluginResponse> {
self.hasher.update(data);
Ok(PluginResponse::default())
Ok(MetaPluginResponse::default())
}
fn meta_name(&self) -> String {

View File

@@ -122,7 +122,7 @@ impl MetaPlugin for MagicFileMetaPlugin {
true
}
fn initialize(&mut self, item_id: i64) -> Result<PluginResponse> {
fn initialize(&mut self, item_id: i64) -> Result<MetaPluginResponse> {
self.item_id = Some(item_id);
// Initialize the magic cookie once
@@ -132,10 +132,10 @@ impl MetaPlugin for MagicFileMetaPlugin {
.map_err(|e| anyhow::anyhow!("Failed to load magic database: {}", e))?;
self.cookie = Some(cookie);
Ok(PluginResponse::default())
Ok(MetaPluginResponse::default())
}
fn finalize(&mut self) -> Result<PluginResponse> {
fn finalize(&mut self) -> Result<MetaPluginResponse> {
let mut metadata = Vec::new();
// Save all magic metadata if not already saved
@@ -170,13 +170,13 @@ impl MetaPlugin for MagicFileMetaPlugin {
}
}
Ok(PluginResponse {
Ok(MetaPluginResponse {
metadata: if metadata.is_empty() { None } else { Some(metadata) },
is_finalized: true,
})
}
fn update(&mut self, data: &[u8]) -> Result<PluginResponse> {
fn update(&mut self, data: &[u8]) -> Result<MetaPluginResponse> {
let mut metadata = Vec::new();
// Only collect up to max_buffer_size
@@ -220,7 +220,7 @@ impl MetaPlugin for MagicFileMetaPlugin {
}
}
Ok(PluginResponse {
Ok(MetaPluginResponse {
metadata: if metadata.is_empty() { None } else { Some(metadata) },
is_finalized: !metadata.is_empty(),
})