21 lines
763 B
Rust
21 lines
763 B
Rust
//! The connection side of the per-agent icon KV bucket: opening it. The
|
|
//! bucket's name, media type and subject are `swarm_wire::agent_icon`.
|
|
|
|
/// Open the agent-icon bucket, creating it if nothing has yet.
|
|
///
|
|
/// `history: 1`, same rationale as [`crate::agent_status::open_or_create`]:
|
|
/// a consumer wants each agent's current icon, not every icon it has ever
|
|
/// had.
|
|
#[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_icon::BUCKET,
|
|
"agent-icon",
|
|
"Current icon published by each agent".to_owned(),
|
|
)
|
|
.await
|
|
}
|