refactor: update ReadRateMetaPlugin to match new MetaPlugin trait signatures
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -279,12 +279,10 @@ impl ReadRateMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for ReadRateMetaPlugin {
|
impl MetaPlugin for ReadRateMetaPlugin {
|
||||||
|
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||||
fn finalize(&mut self) -> Result<MetaPluginResponse> {
|
|
||||||
let mut metadata = Vec::new();
|
let mut metadata = Vec::new();
|
||||||
|
|
||||||
if let Some(start_time) = self.start_time {
|
if let Some(start_time) = self.start_time {
|
||||||
if let Some(item_id) = self.item_id {
|
|
||||||
let duration = start_time.elapsed();
|
let duration = start_time.elapsed();
|
||||||
let rate = if duration.as_secs_f64() > 0.0 {
|
let rate = if duration.as_secs_f64() > 0.0 {
|
||||||
format!("{:.2} KB/s", (self.bytes_read as f64 / 1024.0) / duration.as_secs_f64())
|
format!("{:.2} KB/s", (self.bytes_read as f64 / 1024.0) / duration.as_secs_f64())
|
||||||
@@ -292,24 +290,31 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
|||||||
"N/A".to_string()
|
"N/A".to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(meta) = self.create_meta(item_id, "read_rate", rate) {
|
// Use process_metadata_outputs to handle output mapping
|
||||||
metadata.push(meta);
|
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||||
}
|
"read_rate",
|
||||||
|
rate,
|
||||||
|
&self.outputs
|
||||||
|
) {
|
||||||
|
metadata.push(meta_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(MetaPluginResponse {
|
crate::meta_plugin::MetaPluginResponse {
|
||||||
metadata: Some(metadata),
|
metadata,
|
||||||
is_finalized: true,
|
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() {
|
if self.start_time.is_none() {
|
||||||
self.start_time = Some(Instant::now());
|
self.start_time = Some(Instant::now());
|
||||||
}
|
}
|
||||||
self.bytes_read += data.len() as u64;
|
self.bytes_read += data.len() as u64;
|
||||||
Ok(MetaPluginResponse::default())
|
crate::meta_plugin::MetaPluginResponse {
|
||||||
|
metadata: Vec::new(),
|
||||||
|
is_finalized: false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn meta_name(&self) -> String {
|
fn meta_name(&self) -> String {
|
||||||
|
|||||||
Reference in New Issue
Block a user