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:
@@ -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 {
|
||||
|
||||
@@ -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(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user