nats-io / nats-architecture-and-design

Architecture and Design Docs
Apache License 2.0
177 stars 20 forks source link

List materialized views #154

Open aricart opened 1 year ago

aricart commented 1 year ago

Overview

Go client started listing materialized views like KVs directly. This is useful as it allows the user to list all KVs or ObjectStores returning a value that aligns with the result of status() for KV and ObjectStore as provided in those views. This is syntactic sugar over listing all streams that start with KV_ or OBJ_.

The behavior is documented in ADR-X.

Clients and Tools

Other Tasks

Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.

ripienaar commented 1 year ago

@piotrpio looking at the go PR its returning []string but here it says we should be returning equiv of Status() which you can do in one API call rather than return the names and then having to load each bucket to get at this.

ripienaar commented 1 year ago

@piotrpio my bad, I didnt see you also added a way to get the status, sorry

piotrpio commented 1 year ago

@ripienaar was just about to write that. The methods are added to match what we have for streams and consumers in go client, thus there are both available (even though for KV and object store getting names actually has to fetch streams, so it's more of a convenience than performance improvement).

ripienaar commented 1 year ago

@piotrpio Yeah, sorry for the back and forth, but the KeyValueStores() returns KeyValue, to get status would then be another API call for every stream :(

The streams api call return full stream config and state, you can build up 1000s of kv status objects from a single API call.

piotrpio commented 1 year ago

@ripienaar I'll take a look. This was actually added prior to this issue, but not yet released, so we should be able to fix that without worrying about breaking changes.