-
Notifications
You must be signed in to change notification settings - Fork 49
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
Added a way to set a TTL to key values. #137
Conversation
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.
looks sensible; see comments
chitchat/src/state.rs
Outdated
{ | ||
let versioned_value = node_state.get_versioned("key").unwrap(); | ||
assert_eq!(&versioned_value.value, ""); | ||
assert_eq!(versioned_value.version, 2u64); | ||
assert!(&versioned_value.is_tombstone()); | ||
assert!(&versioned_value.is_deleted()); |
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.
assert!(&versioned_value.is_deleted()); | |
assert!(versioned_value.is_deleted()); |
i don't think the borrow is necessary, and i find it somewhat confusing (is it supposed to be a borrow, or a mistyped !)
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.
yes, I find it confusing too.
chitchat/src/types.rs
Outdated
@@ -108,7 +133,7 @@ impl PartialEq for VersionedValue { | |||
fn eq(&self, other: &Self) -> bool { | |||
self.value.eq(&other.value) | |||
&& self.version.eq(&other.version) | |||
&& self.is_tombstone().eq(&other.is_tombstone()) | |||
&& self.is_deleted().eq(&other.is_deleted()) |
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.
I'm not sure is_deleted is enough to qualify equality. DeletionStatus::Set
and DeletionStatus::DeleteAfterTtl
are considered equal by this statement. If that is intended, a comment should explain why
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.
Thx. I switched to checking the discriminant, added a comment, and made PartialEq cfg test only.
After the GC grace period, the key value will be subject to the GC just like regularly deleted KVs.
After the GC grace period, the key value will be subject to the GC just like regularly deleted KVs.