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,37 +279,42 @@ impl ReadRateMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for ReadRateMetaPlugin {
|
||||
|
||||
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 rate = if duration.as_secs_f64() > 0.0 {
|
||||
format!("{:.2} KB/s", (self.bytes_read as f64 / 1024.0) / duration.as_secs_f64())
|
||||
} else {
|
||||
"N/A".to_string()
|
||||
};
|
||||
let duration = start_time.elapsed();
|
||||
let rate = if duration.as_secs_f64() > 0.0 {
|
||||
format!("{:.2} KB/s", (self.bytes_read as f64 / 1024.0) / duration.as_secs_f64())
|
||||
} else {
|
||||
"N/A".to_string()
|
||||
};
|
||||
|
||||
if let Some(meta) = self.create_meta(item_id, "read_rate", rate) {
|
||||
metadata.push(meta);
|
||||
}
|
||||
// Use process_metadata_outputs to handle output mapping
|
||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||
"read_rate",
|
||||
rate,
|
||||
&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());
|
||||
}
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user