Class Bucket

Implements

Constructors

  • Parameters

    • bucket: string
    • js: JetStreamClient
    • jsm: JetStreamManager

    Returns Bucket

Properties

_prefixLen: number
bucket: string
codec: KvCodecs
direct: boolean
editPrefix: string
hasWildcards: ((k: string) => boolean) = hasWildcards
js: JetStreamClient
jsm: JetStreamManager
prefix: string
stream: string
useJsPrefix: boolean
validateKey: ((k: string) => void) = validateKey
validateSearchKey: ((k: string) => void) = validateSearchKey

Accessors

  • get prefixLen(): number
  • Returns number

Methods

  • Parameters

    • k: string | string[]
    • content: KvWatchInclude
    • opts: Partial<ConsumerConfig> = {}

    Returns Partial<ConsumerConfig>

  • Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Returns string

  • Returns boolean

  • Returns Promise<void>

  • Creates a new entry ensuring that the entry does not exist (or the current version is deleted or the key is purged) If the entry already exists, this operation fails.

    Parameters

    • k: string
    • data: Payload

    Returns Promise<number>

  • Parameters

    • data: Uint8Array
    • Optionalh: MsgHdrs

    Returns number

  • Parameters

    • ekey: string

    Returns string

  • Deletes the entry stored under the specified key. Deletes are soft-deletes. The server will add a new entry marked by a "DEL" operation. Note that if the KV was created with an underlying limit (such as a TTL on keys) it is possible for a key or the soft delete marker to be removed without additional notification on a watch.

    Parameters

    Returns Promise<void>

  • Destroys the underlying stream used by the KV. This effectively deletes all data stored under the KV.

    Returns Promise<boolean>

  • Parameters

    • key: string

    Returns string

  • Parameters

    • k: string

    Returns string

  • Returns the KvEntry stored under the key if it exists or null if not. Note that the entry returned could be marked with a "DEL" or "PURGE" operation which signifies the server stored the value, but it is now deleted.

    Parameters

    • k: string
    • Optionalopts: {
          revision: number;
      }
      • revision: number

    Returns Promise<KvEntry>

  • Returns an iterator of the specified key's history (or all keys). Note you can specify multiple keys if running on server 2.10.x or better.

    Parameters

    • opts: {
          headers_only?: boolean;
          key?: string | string[];
      } = {}
      • Optionalheaders_only?: boolean
      • Optionalkey?: string | string[]

    Returns Promise<QueuedIterator<KvWatchEntry>>

  • Parameters

    Returns Promise<void>

  • Parameters

    • info: StreamInfo

    Returns void

  • Returns an iterator of all the keys optionally matching the specified filter.

    Parameters

    • k: string | string[] = ">"

    Returns Promise<QueuedIterator<string>>

  • Deletes and purges the specified key and any value history.

    Parameters

    Returns Promise<void>

  • Parameters

    • Optionalopts: PurgeOpts

    Returns Promise<PurgeResponse>

  • Parameters

    • olderMillis: number = ...

    Returns Promise<PurgeResponse>

  • Sets or updates the value stored under the specified key.

    Parameters

    Returns Promise<number>

  • Parameters

    • k: string

    Returns Promise<void>

  • Parameters

    • sm: StoredMsg

    Returns KvEntry

  • Returns information about the Kv

    Returns Promise<KvStatus>

  • Returns string

  • Parameters

    • k: string
    • edit: boolean = false

    Returns string

  • Updates the existing entry provided that the previous sequence for the Kv is at the specified version. This ensures that the KV has not been modified prior to the update.

    Parameters

    • k: string
    • data: Payload
    • version: number

    Returns Promise<number>

  • Returns an iterator that will yield KvEntry updates as they happen.

    Parameters

    Returns Promise<QueuedIterator<KvWatchEntry>>

  • Parameters

    • js: JetStreamClient
    • name: string
    • opts: Partial<KvOptions> = {}

    Returns Promise<KV>

  • Parameters

    • js: JetStreamClient
    • name: string
    • opts: Partial<KvOptions> = {}

    Returns Promise<KV>