Skip to content

Kvm.open accepts Partial<KvOptions> but Objm.open does not. #229

@StephanMeijer

Description

@StephanMeijer

Observed behavior

Kvm is defined as following:

/**
 * The entry point to creating new KV instances.
 */
export declare class Kvm {
    #private;
    js: JetStreamClientImpl;
    /**
     * Creates an instance of the Kv that allows you to create and access KV stores.
     * Note that if the argument is a NatsConnection, default JetStream Options are
     * used. If you want to set some options, please provide a JetStreamClient instead.
     * @param nc
     */
    constructor(nc: JetStreamClient | NatsConnection);
    /**
     * Creates and opens the specified KV. If the KV already exists, it opens the existing KV.
     * @param name
     * @param opts
     */
    create(name: string, opts?: Partial<KvOptions>): Promise<KV>;
    /**
     * Open to the specified KV. If the KV doesn't exist, this API will fail.
     * @param name
     * @param opts
     */
    open(name: string, opts?: Partial<KvOptions>): Promise<KV>;
    /**
     * Lists all available KVs
     */
    list(): Lister<KvStatus>;
}

And Objm is defined as following:

export declare class Objm {
    #private;
    js: JetStreamClientImpl;
    /**
     * Creates an instance of the Objm that allows you to create and access ObjectStore.
     * Note that if the argument is a NatsConnection, default JetStream Options are
     * used. If you want to set some options, please provide a JetStreamClient instead.
     * @param nc
     */
    constructor(nc: JetStreamClient | NatsConnection);
    /**
     * Creates and opens the specified ObjectStore. If the ObjectStore already exists,
     * it opens the existing ObjectStore.
     * @param name
     * @param opts
     */
    create(name: string, opts?: Partial<ObjectStoreOptions>): Promise<ObjectStore>;
    /**
     * Opens the specified ObjectStore
     * @param name
     * @param check - if set to false, it will not check if the ObjectStore exists.
     */
    open(name: string, check?: boolean): Promise<ObjectStore>;
    /**
     * Returns a list of ObjectStoreStatus for all streams that are identified as
     * being a ObjectStore (that is having names that have the prefix `OBJ_`)
     */
    list(): Lister<ObjectStoreStatus>;
}

Here I conclude that Kvm.open accepts parameters that only serve a need on creation, not at opening.

Expected behavior

  • Kvm.open and Objm.open to be consistent
  • Both to have the check parameter that will check if the store / bucket exists.

Server and client version

    "@nats-io/jetstream": "^3.0.0-40",
    "@nats-io/kv": "^3.0.0-34",
    "@nats-io/nats-core": "^3.0.0-54",
    "@nats-io/obj": "^3.0.0-36",
    "@nats-io/transport-node": "^3.0.0-38",

Host environment

No response

Steps to reproduce

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions