nats-io / nats-architecture-and-design

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

Add `consumer_limits` and `first_seq` to Stream Config #242

Open Jarema opened 7 months ago

Jarema commented 7 months ago

Overview

Two additional fields were added in 2.10:

consumer_limits

A new field in StreamConfig that is a struct representing consumer limits created on given stream.

// In Stream Config
type StreamConfig struct {
       ...
    // The following defaults will apply to consumers when created against
    // this stream, unless overridden manually.
    ConsumerLimits StreamConsumerLimits `json:"consumer_limits"`
       ...
}

// Struct representing the `consumer_limits` field value.
type StreamConsumerLimits struct {
    InactiveThreshold time.Duration `json:"inactive_threshold,omitempty"`
    MaxAckPending     int           `json:"max_ack_pending,omitempty"`
}

first_seq

Defines sequence from which stream starts when created

type StreamConfig struct {
       ...
    FirstSeq     uint64           `json:"first_seq,omitempty"`
       ...
}

Not documented in ADRs. Not mandatory for 2.10 client release if causes release delay.

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 7 months ago

@neilalexander maybe you can explain the behaviour of these for us, it says:

    // The following defaults will apply to consumers when created against
    // this stream, unless overridden manually.

But also these are limits?

So are they maximums or defaults or both a default and a maximum? I want to be sure to get the description in the schemas right

Jarema commented 7 months ago

I added some explanations based on our discussions.

scottf commented 7 months ago

I've talked directly to Neil and Tomasz. There is some clarity to be gained on the explanation of consumer limits, but I don't think there is anything for the client to do, the server will return an error if there is a constraint violation when updating a stream of adding/updating a consumer. Maybe the explanation just needs to be proliferated to the docs.