-
Notifications
You must be signed in to change notification settings - Fork 671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more Stream and Consumer management APIs #626
Conversation
7910891
to
939afd1
Compare
js.go
Outdated
Consumers []*ConsumerInfo `json:"consumers"` | ||
} | ||
|
||
func (js *js) ListConsumers(stream string, offset int) ([]*ConsumerInfo, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be good if we could hide the paging at this layer or undo it below the covers and just make it a stream of messages with EOF.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right. I added a StreamLister
and ConsumerLister
to iterate through pages.
This is what the calling code looks like.
sl := js.NewStreamLister()
for sl.Next() {
// sl.Page() returns a []*StreamInfo.
// Each iteration can return a maximum of 256 items.
fmt.Println(sl.Page())
}
if err := sl.Err(); err != nil {
return err
}
Here's what it looks like in tests.
https://github.com/nats-io/nats.go/pull/626/files#diff-9e6bdee4051a6e36d6d507dcef63b5f9a39b281e421c08f02ec74a0fb6639e3aR592-R626
9b33844
to
b46e1f3
Compare
b46e1f3
to
077874e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some little changes needed I believe.
f8b6286
to
544e9c4
Compare
Okay, @kozlovic. I think I resolved all of the comments you had. Thanks for the review. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be ok with the change, but I have asked other to chime in with regards to the addition of the timeout in the stream snapshot config struct.
544e9c4
to
89fc61b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check snapshot config for nil and deliver subject.
This adds the follow APIs for Streams. * UpdateStream * DeleteStream * SnapshotStream * RestoreStream * PurgeStream * StreamLister This adds the follow APIs for Consumers. * ConsumerInfo * ConsumerLister * DeleteConsumer
89fc61b
to
1a29e1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@variadico Not sure why you removed snapshot? I think @ripienaar comment was about Timeout in config, but I may be wrong. Clearly, we can always add features later, so I don't have a problem removing, just curious as to why you remove it. |
@wallyqs wanted some more time to think about the snapshotting logic, so I removed that from this PR. That'll be added later. Additionally, he's going to add a few more management APIs. |
We should have DeleteMsg and EraseMsg for the Stream Management API.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, also adding DeleteMsg as a different PR here: Adding DeleteMsg
as a separate PR here #631
This adds the follow APIs for Streams.
This adds the follow APIs for Consumers.