Skip to content
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 flags to NatsMsg and JetStream Request #652

Merged
merged 16 commits into from
Nov 22, 2024
Merged

Add flags to NatsMsg and JetStream Request #652

merged 16 commits into from
Nov 22, 2024

Conversation

mtmk
Copy link
Collaborator

@mtmk mtmk commented Oct 12, 2024

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
Copy link
Collaborator

@to11mtm to11mtm left a comment

Choose a reason for hiding this comment

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

Just some comments/etc.

src/NATS.Client.Core/NatsMsg.cs Outdated Show resolved Hide resolved
src/NATS.Client.Core/NatsMsg.cs Show resolved Hide resolved
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.
@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
Copy link
Contributor

@scottf scottf left a comment

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
13 checks passed
@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