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, LJMError>
Expand description

Opens a KV bucket, creating it if it does not exist.

A new bucket keeps 5 revisions per key; other settings use the async_nats defaults. Used for both the local bucket and the central one, so the streamer also creates the central bucket if it is missing.

§Arguments

  • js - JetStream context of the server that holds the bucket.
  • bucket - Bucket name.

§Errors

Returns an error if the bucket does not exist and cannot be created.