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

fix(storage-manager): validate presence of timestamp #1229

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

J-Loudet
Copy link

@J-Loudet J-Loudet commented Jul 8, 2024

This commit introduces checks before accessing the timestamp associated with a Sample — instead of calling unwrap().

In theory, a Sample should never arrive to a Storage without a Timestamp. In practice, we cannot guarantee this invariant with certainty (future modifications of the code base?). With these checks, the Storage will simply discard the Sample instead of panicking the entire storage manager.

  • plugins/zenoh-plugin-storage-manager/src/replica/storage.rs: add checks when accessing the timestamp and remove unwrap.

This commit introduces checks before accessing the `timestamp`
associated with a Sample — instead of calling `unwrap()`.

In theory, a Sample should never arrive to a Storage without a
Timestamp. In practice, we cannot guarantee this invariant with
certainty (future modifications of the code base?).
With these checks, the Storage will simply discard the Sample instead of
panicking the entire storage manager.

* plugins/zenoh-plugin-storage-manager/src/replica/storage.rs: add
  checks when accessing the timestamp and remove `unwrap`.

Signed-off-by: Julien Loudet <[email protected]>
@J-Loudet J-Loudet requested a review from JEnoch July 8, 2024 10:47
Copy link
Member

@Charles-Schleich Charles-Schleich left a comment

Choose a reason for hiding this comment

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

LGTM

@JEnoch JEnoch merged commit 12b11ee into dev/1.0.0 Jul 8, 2024
23 checks passed
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