Skip to content

Change LengthTag to u64 to fix alignment issue#4

Open
NotGyro wants to merge 3 commits intomasterfrom
milliec-sequencer
Open

Change LengthTag to u64 to fix alignment issue#4
NotGyro wants to merge 3 commits intomasterfrom
milliec-sequencer

Conversation

@NotGyro
Copy link
Collaborator

@NotGyro NotGyro commented Jun 29, 2022

Exactly as described - Rkyv should now be able to deserialize messages read from the message bus because the length tag no longer breaks Rkyv's expected 64-bit alignment for a Sequencer message. All of the tests I've written are passing for sequencer_server.

// No whitelist, match all.
// Length tag
writer.write_u16_le(message.len() as u16).await?;
writer.write_u64_le(message.len() as LengthTag).await?;
Copy link
Owner

Choose a reason for hiding this comment

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

I'm guessing this is using tokio's WriteAsyncExt - is there something equivalent to https://docs.rs/byteorder/latest/byteorder/trait.WriteBytesExt.html#method.write_uint available? Would be nice to only have to change the LengthTag newtype if we change this in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From what I can see there is no official Tokio support for it but a crate for this purpose has been published: https://docs.rs/tokio-byteorder/latest/tokio_byteorder/

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.

2 participants