From 127bdaa001ff96fe2d578d919600860cd273bb65 Mon Sep 17 00:00:00 2001 From: Worph Date: Sun, 4 Oct 2026 17:35:09 +0000 Subject: [PATCH] advertise over beacon v2 as metamesh.enrich/full-hash (SDK v1.7.0 beacon feature) --- Cargo.lock | 15 ++++++++++++++- Cargo.toml | 6 +++++- src/main.rs | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8288af..c74dffb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -802,9 +802,21 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "meta-feeder-sdk" +version = "1.7.0" +source = "git+https://github.com/worph/meta-feeder-sdk?tag=v1.7.0#027917c8cffe7ca43dadcf3b426cc5f69ecc443a" +dependencies = [ + "libc", + "serde", + "serde_json", + "tokio", + "tracing", +] + [[package]] name = "metamesh-plugin-fast-full-hash" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "axum", @@ -815,6 +827,7 @@ dependencies = [ "futures-util", "hex", "md-5", + "meta-feeder-sdk", "multihash", "reqwest", "serde", diff --git a/Cargo.toml b/Cargo.toml index 1efe79a..1059eaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "metamesh-plugin-fast-full-hash" -version = "1.0.0" +version = "1.0.1" edition = "2021" description = "High-performance file hashing plugin for MetaMesh" authors = ["MetaMesh"] @@ -30,6 +30,10 @@ bendy = "0.3" serde = { version = "1", features = ["derive"] } serde_json = "1" +# Beacon v2: advertise as metamesh.enrich/full-hash so meta-sort's Plugins +# page finds it (Scan → Add). Only the SDK's light `beacon` feature. +meta-feeder-sdk = { git = "https://github.com/worph/meta-feeder-sdk", tag = "v1.7.0", default-features = false, features = ["beacon"] } + # HTTP client reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] } diff --git a/src/main.rs b/src/main.rs index 9dab8fa..be6e67e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,6 +59,21 @@ async fn main() -> anyhow::Result<()> { tracing::info!("Starting fast-full-hash plugin on {}", addr); let listener = tokio::net::TcpListener::bind(&addr).await?; + + // Beacon v2: findable by meta-sort's Plugins page (Scan → Add). Advertises + // BEACON_ADVERTISE_URL (default http://$HOSTNAME:) and honours + // BEACON_BINDS, which meta-sort sets on the containers it spawns. + let _beacon = { + use meta_feeder_sdk::beacon::{advertise_plugin, advertise_url, binds_from_env, caps, Resource}; + advertise_plugin("metamesh-plugin-full-hash", env!("CARGO_PKG_VERSION"), move || { + let mut r = Resource::new("full-hash", [caps::enrich("full-hash")]) + .with_endpoint("http", advertise_url(port)) + .with_endpoint("manifest", "/manifest"); + r.binds = binds_from_env(); + r + }) + }; + axum::serve(listener, app).await?; Ok(())