kratart: support for krata channels for two-way byte communication

This commit is contained in:
Alex Zenla
2024-03-28 05:31:57 +00:00
parent d4f1ee5521
commit 63f7db6cf4
9 changed files with 484 additions and 132 deletions

View File

@ -43,7 +43,7 @@ impl XsPermission {
}
pub struct XsdWatchHandle {
id: u32,
pub id: u32,
unwatch_sender: Sender<u32>,
pub receiver: Receiver<String>,
}
@ -202,7 +202,11 @@ impl XsdClient {
}
pub async fn bind_watch<P: AsRef<str>>(&self, handle: &XsdWatchHandle, path: P) -> Result<()> {
let id_string = handle.id.to_string();
self.bind_watch_id(handle.id, path).await
}
pub async fn bind_watch_id<P: AsRef<str>>(&self, id: u32, path: P) -> Result<()> {
let id_string = id.to_string();
let _ = self
.socket
.send(0, XSD_WATCH, &[path.as_ref(), &id_string])