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

18 lines
704 B
Rust

//! The connection side of the agent todo list KV bucket: opening it. The
//! bucket's name, key and value are `swarm_wire::agent_todos`.
/// Open the bucket, creating it if nothing has yet. `history: 1`: the swarm
/// wants each agent's current todos, not the lists it had before.
#[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_todos::BUCKET,
"agent-todos",
"The open todos each agent holds, as its harness last published them".to_owned(),
)
.await
}