diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/Cargo.toml | 2 | ||||
-rw-r--r-- | src/util/crdt/lww.rs | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/util/Cargo.toml b/src/util/Cargo.toml index e33f8a66..d7333161 100644 --- a/src/util/Cargo.toml +++ b/src/util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "garage_util" -version = "0.5.0" +version = "0.5.1" authors = ["Alex Auvolat <alex@adnab.me>"] edition = "2018" license = "AGPL-3.0" diff --git a/src/util/crdt/lww.rs b/src/util/crdt/lww.rs index 43d13f27..6990b865 100644 --- a/src/util/crdt/lww.rs +++ b/src/util/crdt/lww.rs @@ -77,11 +77,21 @@ where self.v = new_value; } + /// Get the timestamp currently associated with the value + pub fn timestamp(&self) -> u64 { + self.ts + } + /// Get the CRDT value pub fn get(&self) -> &T { &self.v } + /// Take the CRDT value + pub fn take(self) -> T { + self.v + } + /// Get a mutable reference to the CRDT's value /// /// This is usefull to mutate the inside value without changing the LWW timestamp. |