nats-io / nats.c

A C client for NATS
Apache License 2.0
390 stars 137 forks source link

jsAccountLimits::MaxBytesRequired is a boolean, should it be int64_t? #691

Closed NostraMagister closed 1 year ago

NostraMagister commented 1 year ago

Observed behavior

The NATS C Client structure jsAccountInfo has a member Limits that holds a jsAccountLimits structure.

This structure in turn has a member MaxBytesRequired of which the datatype is a bool.

Shouldn't that member be defined as int64_t as are the other jsAccountInfo::Limits::... members?

Expected behavior

Expected it to be a numeric variable

Server and client version

NATS C Client

Host environment

Windows/Linux VS C/C++

Steps to reproduce

Just check the structure jsAccountLimits::MaxBytesRequired

kozlovic commented 1 year ago

No, this is really a boolean. It is an account's limit that forces all streams to require a MaxBytes value to be set. In other word, if this boolean is enabled for the account limit and a stream is created without MaxBytes value, the stream creation will fail.

NostraMagister commented 1 year ago

Thank you.

MaxByteSettingRequired might be a name that could emphasize 'booleaness'.

kozlovic commented 1 year ago

This is coming from the server/jwt's library field names. We can't change that now so as to not break backward compatibility. What is missing, is brief documentation after each field :-)

NostraMagister commented 1 year ago

For what it's worth, I have started to write documentation like the one below. If that helps feel free to cut & paste and fill in some ?????. This is for nats.h more specifically jsStreamConfig. Ill have the same for consumers. English is my 3rd language, so some sentence may sound a little strange.

/**

typedef struct jsStreamConfig { /* A zero-terminated string with the name of the stream. It may contain the alphanumeric

} jsStreamConfig;