fix: add missing meta_name implementation and fix compilation errors
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
pub mod program;
|
pub mod program;
|
||||||
pub mod digest;
|
pub mod digest;
|
||||||
@@ -82,6 +80,10 @@ impl BaseMetaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPlugin for BaseMetaPlugin {
|
impl MetaPlugin for BaseMetaPlugin {
|
||||||
|
fn meta_name(&self) -> String {
|
||||||
|
self.meta_name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
&self.outputs
|
&self.outputs
|
||||||
}
|
}
|
||||||
@@ -194,7 +196,8 @@ pub trait MetaPlugin {
|
|||||||
|
|
||||||
// Access to outputs mapping with default implementation
|
// Access to outputs mapping with default implementation
|
||||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
&std::collections::HashMap::new()
|
static EMPTY: std::collections::HashMap<String, serde_yaml::Value> = std::collections::HashMap::new();
|
||||||
|
&EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
@@ -203,7 +206,8 @@ pub trait MetaPlugin {
|
|||||||
|
|
||||||
// Access to options mapping with default implementation
|
// Access to options mapping with default implementation
|
||||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
&std::collections::HashMap::new()
|
static EMPTY: std::collections::HashMap<String, serde_yaml::Value> = std::collections::HashMap::new();
|
||||||
|
&EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use rusqlite::Connection;
|
|
||||||
use crate::common::is_binary::is_binary;
|
use crate::common::is_binary::is_binary;
|
||||||
use crate::common::PIPESIZE;
|
use crate::common::PIPESIZE;
|
||||||
use crate::meta_plugin::{MetaPlugin, MetaPluginResponse, MetaData};
|
use crate::meta_plugin::{MetaPlugin, MetaPluginResponse};
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct BinaryMetaPlugin {
|
pub struct BinaryMetaPlugin {
|
||||||
@@ -66,7 +63,7 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||||
"binary",
|
"binary",
|
||||||
value,
|
value,
|
||||||
&self.outputs
|
self.base.outputs()
|
||||||
) {
|
) {
|
||||||
metadata.push(meta_data);
|
metadata.push(meta_data);
|
||||||
}
|
}
|
||||||
@@ -89,7 +86,7 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
if let Some(meta_data) = crate::meta_plugin::process_metadata_outputs(
|
||||||
"binary",
|
"binary",
|
||||||
value,
|
value,
|
||||||
&self.outputs
|
self.base.outputs()
|
||||||
) {
|
) {
|
||||||
metadata.push(meta_data);
|
metadata.push(meta_data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use rusqlite::Connection;
|
|
||||||
|
|
||||||
use crate::meta_plugin::MetaPlugin;
|
use crate::meta_plugin::MetaPlugin;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use magic::{Cookie, CookieFlags};
|
use magic::{Cookie, CookieFlags};
|
||||||
use rusqlite::Connection;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
use crate::common::PIPESIZE;
|
use crate::common::PIPESIZE;
|
||||||
@@ -128,14 +126,14 @@ impl MetaPlugin for MagicFileMetaPlugin {
|
|||||||
// Initialize the magic cookie once
|
// Initialize the magic cookie once
|
||||||
let cookie = match Cookie::open(Default::default()) {
|
let cookie = match Cookie::open(Default::default()) {
|
||||||
Ok(cookie) => cookie,
|
Ok(cookie) => cookie,
|
||||||
Err(e) => {
|
Err(_e) => {
|
||||||
return crate::meta_plugin::MetaPluginResponse {
|
return crate::meta_plugin::MetaPluginResponse {
|
||||||
metadata: Vec::new(),
|
metadata: Vec::new(),
|
||||||
is_finalized: true,
|
is_finalized: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if let Err(e) = cookie.load(&[] as &[&str]) {
|
if let Err(_e) = cookie.load(&[] as &[&str]) {
|
||||||
return crate::meta_plugin::MetaPluginResponse {
|
return crate::meta_plugin::MetaPluginResponse {
|
||||||
metadata: Vec::new(),
|
metadata: Vec::new(),
|
||||||
is_finalized: true,
|
is_finalized: true,
|
||||||
@@ -173,9 +171,10 @@ impl MetaPlugin for MagicFileMetaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let is_finalized = !metadata.is_empty();
|
||||||
crate::meta_plugin::MetaPluginResponse {
|
crate::meta_plugin::MetaPluginResponse {
|
||||||
metadata,
|
metadata,
|
||||||
is_finalized: !metadata.is_empty(),
|
is_finalized,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
use anyhow::{Context, Result, anyhow};
|
|
||||||
use log::*;
|
use log::*;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::process::{Command, Stdio, Child};
|
use std::process::{Command, Stdio, Child};
|
||||||
use which::which;
|
use which::which;
|
||||||
|
|
||||||
use crate::meta_plugin::{MetaPlugin, MetaData};
|
use crate::meta_plugin::{MetaPlugin, MetaPluginResponse};
|
||||||
|
|
||||||
pub struct MetaPluginProgram {
|
pub struct MetaPluginProgram {
|
||||||
pub program: String,
|
pub program: String,
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use gethostname::gethostname;
|
use gethostname::gethostname;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::process;
|
use std::process;
|
||||||
use uzers::{get_current_uid, get_current_gid, get_user_by_uid, get_group_by_gid};
|
use uzers::{get_current_uid, get_current_gid, get_user_by_uid, get_group_by_gid};
|
||||||
use crate::meta_plugin::{MetaPlugin, MetaPluginResponse, MetaData};
|
use crate::meta_plugin::{MetaPlugin, MetaPluginResponse};
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct CwdMetaPlugin {
|
pub struct CwdMetaPlugin {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use std::io::Read;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use log::warn;
|
|
||||||
|
|
||||||
/// An asynchronous wrapper around the `ItemService` for use in async contexts like the web server.
|
/// An asynchronous wrapper around the `ItemService` for use in async contexts like the web server.
|
||||||
/// It uses `tokio::task::spawn_blocking` to run synchronous database and filesystem operations
|
/// It uses `tokio::task::spawn_blocking` to run synchronous database and filesystem operations
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use crate::db::{self, Meta};
|
|||||||
use crate::compression_engine::{get_compression_engine, CompressionType};
|
use crate::compression_engine::{get_compression_engine, CompressionType};
|
||||||
use crate::modes::common::settings_compression_type;
|
use crate::modes::common::settings_compression_type;
|
||||||
use clap::Command;
|
use clap::Command;
|
||||||
use log::{debug, warn};
|
use log::debug;
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|||||||
Reference in New Issue
Block a user