Import upstream v0.16.22, stripped

Upstream commit: 474dd0229cb20cf513036619781ed97bd8073c3f
Enterprise-only files removed or emptied: 63
Enterprise-only snippets removed: 117 in 50 files
Dangling module declarations removed: 5
Cargo edits turning enterprise off: 14
Verification: clean
Enterprise feature gates left for rebuilt features: 19 in 18 files

Produced by tools/fork/strip.py. The full report is in docs/fork/strip-reports/ on main.
This commit is contained in:
2026-09-18 10:21:56 -07:00
commit 7dae9b29fd
1650 changed files with 485521 additions and 0 deletions
@@ -0,0 +1,27 @@
/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
use registry::schema::structs::ZenohCoordinator;
use crate::Coordinator;
pub mod pubsub;
#[derive(Debug)]
pub struct ZenohPubSub {
session: zenoh::Session,
}
impl ZenohPubSub {
pub async fn open(config: ZenohCoordinator) -> Result<Coordinator, String> {
let zenoh_config = zenoh::Config::from_json5(&config.config)
.map_err(|err| format!("Invalid Zenoh config: {}", err))?;
zenoh::open(zenoh_config)
.await
.map_err(|err| format!("Failed to create Zenoh session: {}", err))
.map(|session| ZenohPubSub { session })
.map(|store| Coordinator::Zenoh(std::sync::Arc::new(store)))
}
}
@@ -0,0 +1,47 @@
/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
use super::ZenohPubSub;
use crate::{Msg, PubSubStream};
use trc::{ClusterEvent, Error, EventType};
pub struct ZenohPubSubStream {
subs: zenoh::pubsub::Subscriber<zenoh::handlers::FifoChannelHandler<zenoh::sample::Sample>>,
}
impl ZenohPubSub {
pub async fn publish(&self, topic: &'static str, message: Vec<u8>) -> trc::Result<()> {
self.session
.declare_publisher(topic)
.await
.map_err(|err| {
Error::new(EventType::Cluster(ClusterEvent::PublisherError)).reason(err)
})?
.put(message)
.await
.map_err(|err| Error::new(EventType::Cluster(ClusterEvent::PublisherError)).reason(err))
}
pub async fn subscribe(&self, topic: &'static str) -> trc::Result<PubSubStream> {
self.session
.declare_subscriber(topic)
.await
.map(|subs| PubSubStream::Zenoh(ZenohPubSubStream { subs }))
.map_err(|err| {
Error::new(EventType::Cluster(ClusterEvent::SubscriberError)).reason(err)
})
}
}
impl ZenohPubSubStream {
pub async fn next(&mut self) -> Option<Msg> {
self.subs
.recv_async()
.await
.map(|sample| Msg::Zenoh(sample.payload().to_bytes().into_owned()))
.ok()
}
}