Skip to content

Add flags to NatsMsg and JetStream Request#652

Merged
mtmk merged 16 commits into
mainfrom
nats-msg-flags
Nov 22, 2024
Merged

Add flags to NatsMsg and JetStream Request#652
mtmk merged 16 commits into
mainfrom
nats-msg-flags

Conversation

@mtmk

@mtmk mtmk commented Oct 12, 2024

Copy link
Copy Markdown
Member

This is part of preparing to reduce exception usage as stated in #581.

Note that a similar attempt was made in #275 but due to NatsMsg struct size getting larger it wasn't merged. With this PR we're using the message size fields left most two bits to set the flags relying on the fact a 30-bit field would still be large enough to hold message size int.

JetStream request changed to handle API error responses without throwing exceptions.

@mtmk mtmk changed the title Add flags to NatsMsg Add flags to NatsMsg and JetStream Request Oct 12, 2024
Comment thread src/NATS.Client.Core/NatsMsg.cs Outdated

@to11mtm to11mtm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments/etc.

Comment thread src/NATS.Client.JetStream/Internal/NatsJSForcedJsonDocumentSerializer.cs Outdated
Comment thread tests/NATS.Client.CoreUnit.Tests/NatsMsgTests.cs
Comment thread src/NATS.Client.Core/NatsMsg.cs Outdated
Comment thread src/NATS.Client.Core/NatsMsg.cs
mtmk added 4 commits October 13, 2024 02:32
Reordered error checks in `NatsJSContext.cs` to prioritize handling `HasNoResponders` and `null` data conditions early. Modified flag checks in `NatsMsg.cs` for `IsEmpty` and `HasNoResponders` by directly using bitwise operations instead of enum comparisons.
Comment thread src/NATS.Client.JetStream/NatsJSContext.cs Outdated
@mtmk mtmk self-assigned this Nov 12, 2024
@mtmk
mtmk requested a review from scottf November 21, 2024 12:24
@mtmk
mtmk marked this pull request as ready for review November 21, 2024 12:24

@scottf scottf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mtmk
mtmk merged commit 3771b04 into main Nov 22, 2024
@mtmk
mtmk deleted the nats-msg-flags branch November 22, 2024 12:02
mtmk added a commit that referenced this pull request Dec 10, 2024
* Add password support for PFX files (#694)
* Add KV try get (#688)
* Jetstream CreateOrUpdateStream (#692)
* Update README.md (#683)
* Add (force) reconnect method (#684)
* Add flags to NatsMsg and JetStream Request (#652)
@mtmk mtmk mentioned this pull request Dec 10, 2024
mtmk added a commit that referenced this pull request Dec 10, 2024
* Add password support for PFX files (#694)
* Add KV try get (#688)
* Jetstream CreateOrUpdateStream (#692)
* Update README.md (#683)
* Add (force) reconnect method (#684)
* Add flags to NatsMsg and JetStream Request (#652)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants