-
Notifications
You must be signed in to change notification settings - Fork 591
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
introduce struct BasicProperties for basicPublish #1096
introduce struct BasicProperties for basicPublish #1096
Conversation
4b7d077
to
fe4a583
Compare
Thank you. Looks like this is still a WIP? I run into compilation errors:
|
Ah probably my last rebase against main... sorry for that. I'll update it when I ran the benchmarks👍🏼 |
fe4a583
to
7fca46f
Compare
7fca46f
to
288344d
Compare
Summary: Remaining memory allocation for sending and receiving is mostly string creation. |
@@ -187,7 +188,8 @@ public interface IModel : IDisposable | |||
/// Routing key must be shorter than 255 bytes. | |||
/// </para> | |||
/// </remarks> | |||
void BasicPublish(string exchange, string routingKey, bool mandatory, IBasicProperties basicProperties, ReadOnlyMemory<byte> body); | |||
void BasicPublish<TProperties>(string exchange, string routingKey, ref TProperties basicProperties, ReadOnlyMemory<byte> body = default, bool mandatory = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having ref in the outer interface is maybe something to discuss, as it forces everyone to write BasicPublish("exchange", "routingkey", ref properties, body)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we switch it to in, it means that we have to copy the struct once.
This is ready for review. |
288344d
to
af8c072
Compare
rebased after latest additions in main. |
can this be reviewed? |
@michaelklishin can we get this reviewed / approved? |
Reminder for review |
I had to update |
Whoops, my idea was just to review, as this change does have impact on some basic API that will require some turtorials/docu update. Were you aware of this? |
{ | ||
if (frame.Type != FrameType.FrameHeader) | ||
{ | ||
throw new UnexpectedFrameException(frame.Type); | ||
} | ||
|
||
ReadOnlySpan<byte> span = frame.Payload.Span; | ||
_header = _protocol.DecodeContentHeaderFrom(NetworkOrderDeserializer.ReadUInt16(span), span.Slice(12)); | ||
var classId = NetworkOrderDeserializer.ReadUInt16(span); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, this is where #1260 was introduced :)
Proposed Changes
Introduces a struct BasicProperties and opens up the header implementation to a public.
Changes in detail:
Types of Changes
Checklist
CONTRIBUTING.md
documentFurther Comments
I'm going to post a few benchmark numbers as soon as I get around to run them. (soon)