fix: update meta plugin implementations to match trait signatures
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -54,35 +54,41 @@ impl DigestSha256MetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for DigestSha256MetaPlugin {
|
||||
|
||||
fn initialize(&mut self, item_id: i64) -> Result<MetaPluginResponse> {
|
||||
self.item_id = Some(item_id);
|
||||
Ok(MetaPluginResponse::default())
|
||||
fn initialize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> Result<MetaPluginResponse> {
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
let mut metadata = Vec::new();
|
||||
|
||||
if let Some(item_id) = self.item_id {
|
||||
// Finalize the hash
|
||||
let hash_result = self.hasher.finalize_reset();
|
||||
let hex_string = format!("{:x}", hash_result);
|
||||
// Finalize the hash
|
||||
let hash_result = self.hasher.finalize_reset();
|
||||
let hex_string = format!("{:x}", hash_result);
|
||||
|
||||
// Create metadata to be stored
|
||||
if let Some(meta) = self.create_meta(item_id, "digest_sha256", hex_string) {
|
||||
metadata.push(meta);
|
||||
}
|
||||
// Use process_metadata_outputs to handle output mapping
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"digest_sha256",
|
||||
hex_string,
|
||||
&self.outputs
|
||||
) {
|
||||
metadata.push(meta_data);
|
||||
}
|
||||
|
||||
Ok(MetaPluginResponse {
|
||||
metadata: Some(metadata),
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata,
|
||||
is_finalized: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, data: &[u8]) -> Result<MetaPluginResponse> {
|
||||
fn update(&mut self, data: &[u8]) -> crate::meta_plugin::MetaPluginResponse {
|
||||
self.hasher.update(data);
|
||||
Ok(MetaPluginResponse::default())
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn meta_name(&self) -> String {
|
||||
@@ -162,32 +168,37 @@ impl ReadTimeMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for ReadTimeMetaPlugin {
|
||||
|
||||
fn finalize(&mut self) -> Result<MetaPluginResponse> {
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
let mut metadata = Vec::new();
|
||||
|
||||
if let Some(start_time) = self.start_time {
|
||||
if let Some(item_id) = self.item_id {
|
||||
let duration = start_time.elapsed();
|
||||
let duration_str = format!("{:.3} seconds", duration.as_secs_f64());
|
||||
let duration = start_time.elapsed();
|
||||
let duration_str = format!("{:.3} seconds", duration.as_secs_f64());
|
||||
|
||||
if let Some(meta) = self.create_meta(item_id, "read_time", duration_str) {
|
||||
metadata.push(meta);
|
||||
}
|
||||
// Use process_metadata_outputs to handle output mapping
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"read_time",
|
||||
duration_str,
|
||||
&self.outputs
|
||||
) {
|
||||
metadata.push(meta_data);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(MetaPluginResponse {
|
||||
metadata: Some(metadata),
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata,
|
||||
is_finalized: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, _data: &[u8]) -> Result<MetaPluginResponse> {
|
||||
fn update(&mut self, _data: &[u8]) -> crate::meta_plugin::MetaPluginResponse {
|
||||
if self.start_time.is_none() {
|
||||
self.start_time = Some(Instant::now());
|
||||
}
|
||||
Ok(MetaPluginResponse::default())
|
||||
crate::meta_plugin::MetaPluginResponse {
|
||||
metadata: Vec::new(),
|
||||
is_finalized: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn meta_name(&self) -> String {
|
||||
|
||||
Reference in New Issue
Block a user