Skip to content

Conversation

CuddlyBunion341
Copy link
Owner

@CuddlyBunion341 CuddlyBunion341 commented Nov 6, 2024

Implement RLE of integer buffers for more efficient data transfer once client/server is rearchitectured.
Inspired by INCO Praktikum @ ZHAW.

@CuddlyBunion341 CuddlyBunion341 self-assigned this Nov 6, 2024
let mut vec = Vec::<BlockId>::new();

bytes.iter().for_each(|byte| {
let symbol_bytes = &byte[0..4];
Copy link
Owner Author

Choose a reason for hiding this comment

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

Todo: Reduce token size
Todo: Handle large tokens (> 4 Bits)

vec.push(symbol);
}

i += 3;
Copy link
Owner Author

Choose a reason for hiding this comment

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

Magic number

let mut i = 0;
while i < bytes.len() {
let symbol = bytes[i];
let count_bytes = &bytes[i + 1..i + 3];
Copy link
Owner Author

Choose a reason for hiding this comment

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

Magic number

@CuddlyBunion341 CuddlyBunion341 changed the title Feature/chunk serialization Chunk Serialization Nov 14, 2024
RedTerracotta,
Terracotta,
YellowTerracotta,
macro_rules! enum_from_u8 {
Copy link
Owner Author

Choose a reason for hiding this comment

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

I don't plan on learning macros just yet, so this generated stuff is way beyond my understanding but it keeps the enum definition clear. 🪄

}
}

impl<'de> Deserialize<'de> for Chunk {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Inspired by the deserialization docs:
https://serde.rs/impl-serializer.html

@CuddlyBunion341 CuddlyBunion341 merged commit 42d8d65 into main Nov 14, 2024
3 checks passed
@CuddlyBunion341 CuddlyBunion341 deleted the feature/chunk-serialization branch November 14, 2024 19:11

let mut bytes = Vec::<u8>::new();
tokens.iter().for_each(|token| {
let symbol_bytes = token.symbol.to_le_bytes();
Copy link
Owner Author

Choose a reason for hiding this comment

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

le := little endian

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.

1 participant