swarm: an agent's open todos, mirrored to the queue and served by the controller
This commit is contained in:
parent
c9604a6708
commit
b239500f88
1 changed files with 478 additions and 6 deletions
18
swarm-queue-client/src/agent_todos.rs
Normal file
18
swarm-queue-client/src/agent_todos.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//! 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
|
||||
}
|
||||
Loading…
Reference in a new issue