refactor: decouple meta plugins from DB via SaveMetaFn callback, extract shared utilities
- Add SaveMetaFn callback pattern: meta plugins receive a closure instead of
&Connection, enabling the same plugin code to work in local, client, and
server contexts (collect-to-Vec, collect-to-HashMap, or direct DB write)
- Client save now runs meta plugins locally during streaming (smart client
sets meta=false, server skips its own plugins)
- Add POST /api/item/{id}/update endpoint for re-running plugins on stored
content without downloading compressed data
- Add client update mode (--update with --meta-plugin flags)
- Extract shared utilities: stream_copy, print_serialized, build_path_table,
ensure_default_tag to reduce duplication across modes
- Add upsert_tag for idempotent tag addition (INSERT OR IGNORE)
- Add warn logging on save_meta lock failure in BaseMetaPlugin and MetaService
This commit is contained in:
@@ -17,22 +17,13 @@ pub fn mode(
|
||||
let output_format = settings_output_format(settings);
|
||||
|
||||
match output_format {
|
||||
OutputFormat::Json => {
|
||||
println!("{}", serde_json::to_string_pretty(&status_info)?);
|
||||
}
|
||||
OutputFormat::Yaml => {
|
||||
println!("{}", serde_yaml::to_string(&status_info)?);
|
||||
OutputFormat::Json | OutputFormat::Yaml => {
|
||||
crate::modes::common::print_serialized(&status_info, &output_format)?;
|
||||
}
|
||||
OutputFormat::Table => {
|
||||
// Paths
|
||||
let mut path_table =
|
||||
crate::modes::common::create_table_with_config(&settings.table_config);
|
||||
path_table.set_header(vec![
|
||||
Cell::new("Type").add_attribute(Attribute::Bold),
|
||||
Cell::new("Path").add_attribute(Attribute::Bold),
|
||||
]);
|
||||
path_table.add_row(vec!["Data", &status_info.paths.data]);
|
||||
path_table.add_row(vec!["Database", &status_info.paths.database]);
|
||||
let path_table =
|
||||
crate::modes::common::build_path_table(&status_info.paths, &settings.table_config);
|
||||
println!("PATHS:");
|
||||
println!(
|
||||
"{}",
|
||||
|
||||
Reference in New Issue
Block a user