Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/swarm-queue-client/src/agent_closures.rs

19 lines
713 B
Rust

//! The connection side of the per-agent closure KV bucket. The bucket's names
//! and stored type are `swarm_wire::agent_closures`.
/// Open the closures bucket for writing, creating it if nothing has yet.
///
/// **Controller-side only.** `history: 1`: a reader wants the latest build.
#[cfg(feature = "kv")]
pub async fn open_or_create(
client: &async_nats::Client,
) -> Result<async_nats::jetstream::kv::Store, crate::Error> {
let js = async_nats::jetstream::new(client.clone());
crate::kv::open_or_create(
&js,
swarm_wire::agent_closures::BUCKET,
"agent-closures",
"The latest system closure the swarm builder built for each agent".to_owned(),
)
.await
}