Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make adminspace return current metadata #1221

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions zenoh/src/net/runtime/adminspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ use crate::{
pub struct AdminContext {
runtime: Runtime,
version: String,
metadata: serde_json::Value,
}

type Handler = Arc<dyn Fn(&AdminContext, Query) + Send + Sync>;
Expand Down Expand Up @@ -153,7 +152,6 @@ impl AdminSpace {
let zid_str = runtime.state.zid.to_string();
let whatami_str = runtime.state.whatami.to_str();
let mut config = runtime.config().lock();
let metadata = runtime.state.metadata.clone();
let root_key: OwnedKeyExpr = format!("@/{whatami_str}/{zid_str}").try_into().unwrap();

let mut handlers: HashMap<_, Handler> = HashMap::new();
Expand Down Expand Up @@ -221,7 +219,6 @@ impl AdminSpace {
let context = Arc::new(AdminContext {
runtime: runtime.clone(),
version,
metadata,
});
let admin = Arc::new(AdminSpace {
zid: runtime.zid(),
Expand Down Expand Up @@ -601,7 +598,7 @@ fn local_data(context: &AdminContext, query: Query) {
let mut json = json!({
"zid": context.runtime.state.zid,
"version": context.version,
"metadata": context.metadata,
"metadata": context.runtime.config().lock().metadata(),
"locators": locators,
"sessions": transports,
"plugins": plugins,
Expand Down
3 changes: 0 additions & 3 deletions zenoh/src/net/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ pub(crate) struct RuntimeState {
zid: ZenohId,
whatami: WhatAmI,
next_id: AtomicU32,
metadata: serde_json::Value,
router: Arc<Router>,
config: Notifier<Config>,
manager: TransportManager,
Expand Down Expand Up @@ -138,7 +137,6 @@ impl RuntimeBuilder {
tracing::info!("Using ZID: {}", zid);

let whatami = unwrap_or_default!(config.mode());
let metadata = config.metadata().clone();
let hlc = (*unwrap_or_default!(config.timestamping().enabled().get(whatami)))
.then(|| Arc::new(HLCBuilder::new().with_id(uhlc::ID::from(&zid)).build()));

Expand Down Expand Up @@ -179,7 +177,6 @@ impl RuntimeBuilder {
zid: zid.into(),
whatami,
next_id: AtomicU32::new(1), // 0 is reserved for routing core
metadata,
router,
config: config.clone(),
manager: transport_manager,
Expand Down