Skip to main content

ensure_kv_bucket

Function ensure_kv_bucket 

Source
pub(crate) async fn ensure_kv_bucket(
    js: &Context,
    bucket: &str,
) -> Result<Store, Box<dyn Error + Send + Sync>>
Expand description

Opens or creates the KV bucket that contains dashboard configuration.

If opening the bucket fails for any reason, the function tries to create it with a history of 5 revisions per key.

§Arguments

  • js - JetStream context of the server that holds the bucket.
  • bucket - Bucket name, for example avenabox.

§Errors

Returns an error if the bucket cannot be opened and creating it also fails.