Closed NostraMagister closed 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.
Thank you.
MaxByteSettingRequired might be a name that could emphasize 'booleaness'.
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 :-)
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
*/
const char *Name;
/* A zero-terminated string with a humanly readable description of the intended use of the stream. This string
can contain most characters as it isn't used in any technical capacity. There is NO default setting. / const char Description;
/* A array of zero-terminated strings with subjects. If there are no subjects provided the library will use the stream
name as the default subject. The default setting is ????? */ const char **Subjects;
/* An positive value, or zero, indicated the number of elements in the Subjects array. If the value is zero there will
still by at least one subject because the library will use the stream Name as the default topic. */ int SubjectsLen;
/* A variable holding one of the values as defined by jsRetentionPolicy. The retention policy tells the NATS server
The default setting is jsRetentionPolicy:: ????? */ jsRetentionPolicy Retention;
/* A positive numeric value indicating the maximum consumers that may be associated with this specific stream. If exceeded
the library will refuse the addition with #js_AddConsumer or tools such as the NATS CLI. The default value is ?????
*/
int64_t MaxConsumers;
/* A positive numeric value indicating what the maximum number of pending messages is that may be awaiting in the
rather then processing it the normal way. The default value is ????? */ int64_t MaxMsgs;
/* A positive numeric value that is an additional restriction on waiting messages by specifying it as a volume of bytes.
just be number of messages may be insufficient. The default value is ????? */ int64_t MaxBytes;
/* A positive numeric variable, or zero, to indicate that messages must be deleted from the queue waiting for processing
evaluation. The default value is ????? */ int64_t MaxAge;
/* A positive numeric value that allows to set the maximum number of messages that a single subject, as defined in the
subjects for this specific stream. The default value is ????? */ int64_t MaxMsgsPerSubject;
/* A positive message setting the maximum allowed sized of a single message. NATS is message agnostic and hence the body of
refers to the complete size of the message in bytes. The default is ????? NOTE: Verify & confirm if this refers to the complete msg size and not just the msg body size? */ int32_t MaxMsgSize;
/* A variable holding one of the values as defined by jsDiscardPolicy.
See also the DiscardNewPerSubject member of this configuration. The default is ????? */ jsDiscardPolicy Discard;
jsStorageType Storage;
int64_t Replicas;
/* Boolean variable that allows to suppress acknowledgement. By default when a message is publish on a stream, it is acknowledge
The default is false. */ bool NoAck;
const char *Template;
int64_t Duplicates;
jsPlacement *Placement;
jsStreamSource *Mirror;
jsStreamSource **Sources;
int SourcesLen;
/* A Boolean variable allowing to seal this specific stream so that no messages can get in or out anymore.
The default is false. */ bool Sealed;
/* A Boolean variable allowing to deny the deletion of messages from this specific stream to functions that
on purging parameters that apply to the stream. */ bool DenyDelete;
/* A Boolean variable allowing to deny the purging of messages from this specific stream to functions that
on purging parameters that apply to the stream, mostly after a new connection. */ bool DenyPurge;
/* A Boolean variable allowing to deny roll-up operations. Roll-up operations uses 'special' formatted message
*/
bool AllowRollup;
/* A jsRePublish structure to allows source subjects to be mapped to a destination subject for republishing.
The default is ????? / jsRePublish RePublish;
/* This Boolean variable allows direct access to individual messages which might increase performance.
to true one can access a single KeyValue rather then a complete Bucket. */ bool AllowDirect;
// Allow higher performance and unified direct access for mirrors as well.
bool MirrorDirect;
/* A Boolean variable that allows to fine tune the Discard member settings. If set to true the behavior selected
} jsStreamConfig;
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