advertise over beacon v2 as metamesh.enrich/full-hash (SDK v1.7.0 beacon feature)
This commit is contained in:
Generated
+14
-1
@@ -802,9 +802,21 @@ version = "2.7.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
|
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]]
|
[[package]]
|
||||||
name = "metamesh-plugin-fast-full-hash"
|
name = "metamesh-plugin-fast-full-hash"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -815,6 +827,7 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"hex",
|
"hex",
|
||||||
"md-5",
|
"md-5",
|
||||||
|
"meta-feeder-sdk",
|
||||||
"multihash",
|
"multihash",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
+5
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "metamesh-plugin-fast-full-hash"
|
name = "metamesh-plugin-fast-full-hash"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "High-performance file hashing plugin for MetaMesh"
|
description = "High-performance file hashing plugin for MetaMesh"
|
||||||
authors = ["MetaMesh"]
|
authors = ["MetaMesh"]
|
||||||
@@ -30,6 +30,10 @@ bendy = "0.3"
|
|||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
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
|
# HTTP client
|
||||||
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] }
|
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] }
|
||||||
|
|
||||||
|
|||||||
+15
@@ -59,6 +59,21 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
tracing::info!("Starting fast-full-hash plugin on {}", addr);
|
tracing::info!("Starting fast-full-hash plugin on {}", addr);
|
||||||
|
|
||||||
let listener = tokio::net::TcpListener::bind(&addr).await?;
|
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:<port>) 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?;
|
axum::serve(listener, app).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user