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

Encoding and timestamp serialization remove from zenoh-ext #1520

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

milyin
Copy link
Contributor

@milyin milyin commented Oct 8, 2024

No description provided.

Copy link

github-actions bot commented Oct 8, 2024

PR missing one of the required labels: {'internal', 'bug', 'breaking-change', 'new feature', 'enhancement', 'dependencies', 'documentation'}

@milyin milyin added internal Changes not included in the changelog api fix Correct API labels Oct 8, 2024
@milyin milyin marked this pull request as ready for review October 8, 2024 16:25
@@ -608,12 +545,11 @@ mod tests {
fn timestamp_serialization() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed. Made it to make sure that we still can serialize timestamp and as an example, but yes, this is excessive

/// A UTF-8 string.
///
/// Constant alias for string: `"zenoh/string"`.
///
/// Usually used for types: `String`, `&str`, `Cow<str>`, `char`.
/// This encoding supposes that the payload was created with [`ZBytes::from::<String>`](crate::bytes::ZBytes::from) or similar
/// (`&str`, `Cow<str>`, `char`) and it's data can be acquired with [`ZBytes::try_to_string()`](crate::bytes::ZBytes::try_to_string) without an error.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no implementation for char. Btw, why enumerating similar here and not above for ZENOH_BYTES?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed char, added similar comment to bytes

/// A UTF-8 string.
///
/// Constant alias for string: `"zenoh/string"`.
///
/// Usually used for types: `String`, `&str`, `Cow<str>`, `char`.
/// This encoding supposes that the payload was created with [`ZBytes::from::<String>`](crate::bytes::ZBytes::from) or similar
/// (`&str`, `Cow<str>`, `char`) and it's data can be acquired with [`ZBytes::try_to_string()`](crate::bytes::ZBytes::try_to_string) without an error.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// (`&str`, `Cow<str>`, `char`) and it's data can be acquired with [`ZBytes::try_to_string()`](crate::bytes::ZBytes::try_to_string) without an error.
/// (`&str`, `Cow<str>`, `char`) and its data can be accessed with [`ZBytes::try_to_string()`](crate::bytes::ZBytes::try_to_string).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

14u16 => "zenoh/string",
15u16 => "zenoh/error",
1u16 => "zenoh/string",
15u16 => "zenoh/serialized",
Copy link
Contributor

Choose a reason for hiding this comment

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

You really want to "reserve" encoding slots?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this makes sense. Later we can even restore primitive types encoding to these slots, with names like zenoh/serialized;u8, zenoh/serialized;i16, etc - when the schema for zenoh encoding is elaborated (this is @kydos 's idea)

Copy link
Contributor

Choose a reason for hiding this comment

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

Then you will surely need more than 2..16 range, so why not reserving more? Why do we care having zenoh encodings first? (except for zenoh/bytes which must obviously be 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly because it allows us not to change existing numeration. Yes, it's internal and as we know these codes are not used anywhere, but as it costs nothing to us, better not to break compatibility when we can.
But this is really minor question. If you are strongly against this gap, let's remove it, it's cheaper than discuss it too long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api fix Correct API internal Changes not included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants