diff --git a/radicle-crdt/src/change.rs b/radicle-crdt/src/change.rs
index 3c5c258f..17035f81 100644
--- a/radicle-crdt/src/change.rs
+++ b/radicle-crdt/src/change.rs
@@ -3,10 +3,10 @@ use std::collections::BTreeMap;
use radicle_crypto::{PublicKey, Signature, Signer};
use serde::{Deserialize, Serialize};
-use crate::clock::LClock;
+use crate::clock::Lamport;
/// Identifies a change.
-pub type ChangeId = (LClock, ActorId);
+pub type ChangeId = (Lamport, ActorId);
/// The author of a change.
pub type ActorId = PublicKey;
@@ -20,7 +20,7 @@ pub struct Change {
/// The author of the change.
pub author: ActorId,
/// Lamport clock.
- pub clock: LClock,
+ pub clock: Lamport,
}
impl Change {
@@ -63,20 +63,20 @@ pub struct Envelope {
#[derive(Default)]
pub struct Actor {
pub signer: G,
- pub clock: LClock,
- pub changes: BTreeMap<(LClock, PublicKey), Change>,
+ pub clock: Lamport,
+ pub changes: BTreeMap<(Lamport, PublicKey), Change>,
}
impl Actor {
pub fn new(signer: G) -> Self {
Self {
signer,
- clock: LClock::default(),
+ clock: Lamport::default(),
changes: BTreeMap::default(),
}
}
- pub fn receive(&mut self, changes: impl IntoIterator- >) -> LClock {
+ pub fn receive(&mut self, changes: impl IntoIterator
- >) -> Lamport {
for change in changes {
let clock = change.clock;
@@ -89,7 +89,7 @@ impl Actor {
/// Reset actor state to initial state.
pub fn reset(&mut self) {
self.changes.clear();
- self.clock = LClock::default();
+ self.clock = Lamport::default();
}
/// Returned an ordered list of events.
diff --git a/radicle-crdt/src/clock.rs b/radicle-crdt/src/clock.rs
index 888cd11d..62f57376 100644
--- a/radicle-crdt/src/clock.rs
+++ b/radicle-crdt/src/clock.rs
@@ -6,11 +6,11 @@ use crate::Semilattice as _;
/// Lamport clock.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[serde(transparent)]
-pub struct LClock {
+pub struct Lamport {
counter: Max,
}
-impl LClock {
+impl Lamport {
/// Return the clock value.
pub fn get(&self) -> u64 {
*self.counter.get()
@@ -31,7 +31,7 @@ impl LClock {
}
}
-impl From for LClock {
+impl From for Lamport {
fn from(counter: u64) -> Self {
Self {
counter: Max::from(counter),
diff --git a/radicle-crdt/src/lib.rs b/radicle-crdt/src/lib.rs
index 698b08d8..f9b58a53 100644
--- a/radicle-crdt/src/lib.rs
+++ b/radicle-crdt/src/lib.rs
@@ -16,7 +16,7 @@ pub mod test;
////////////////////////////////////////////////////////////////////////////////
pub use change::*;
-pub use clock::LClock;
+pub use clock::Lamport;
pub use lwwmap::LWWMap;
pub use lwwreg::LWWReg;
pub use lwwset::LWWSet;
diff --git a/radicle/src/cob/issue.rs b/radicle/src/cob/issue.rs
index a281e66a..43751baf 100644
--- a/radicle/src/cob/issue.rs
+++ b/radicle/src/cob/issue.rs
@@ -3,7 +3,8 @@ use std::str::FromStr;
use once_cell::sync::Lazy;
use radicle_crdt as crdt;
-use radicle_crdt::{ChangeId, LClock, LWWReg, Max, Semilattice};
+use radicle_crdt::clock;
+use radicle_crdt::{ChangeId, LWWReg, Max, Semilattice};
use serde::{Deserialize, Serialize};
use thiserror::Error;
@@ -73,10 +74,10 @@ impl Status {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Issue {
// TODO(cloudhead): Title should bias towards shorter strings.
- title: LWWReg, LClock>,
- status: LWWReg, LClock>,
+ title: LWWReg, clock::Lamport>,
+ status: LWWReg, clock::Lamport>,
thread: Thread,
- clock: LClock,
+ clock: clock::Lamport,
}
impl Semilattice for Issue {
@@ -93,7 +94,7 @@ impl Default for Issue {
title: Max::from(String::default()).into(),
status: Max::from(Status::default()).into(),
thread: Thread::default(),
- clock: LClock::default(),
+ clock: clock::Lamport::default(),
}
}
}
@@ -146,7 +147,7 @@ impl Issue {
self.thread.comments().map(|(id, comment)| (id, comment))
}
- pub fn clock(&self) -> &LClock {
+ pub fn clock(&self) -> &clock::Lamport {
&self.clock
}
@@ -186,14 +187,14 @@ impl Deref for Issue {
pub struct IssueMut<'a, 'g> {
id: ObjectId,
- clock: LClock,
+ clock: clock::Lamport,
issue: Issue,
store: &'g mut Issues<'a>,
}
impl<'a, 'g> IssueMut<'a, 'g> {
/// Get the internal logical clock.
- pub fn clock(&self) -> &LClock {
+ pub fn clock(&self) -> &clock::Lamport {
&self.clock
}
@@ -372,7 +373,7 @@ impl<'a> Issues<'a> {
let change = Change {
author: self.author().id,
action: Action::Title { title },
- clock: LClock::default(),
+ clock: clock::Lamport::default(),
};
let (id, issue): (_, Issue) = self.raw.create("Create issue", change, signer)?;
let mut issue = IssueMut {
@@ -485,7 +486,7 @@ mod test {
.create("My first issue", "Blah blah blah.", &[], &signer)
.unwrap();
- let comment = (LClock::default(), *signer.public_key());
+ let comment = (clock::Lamport::default(), *signer.public_key());
let reaction = Reaction::new('🥳').unwrap();
issue.react(comment, reaction, &signer).unwrap();
diff --git a/radicle/src/cob/thread.rs b/radicle/src/cob/thread.rs
index f687c6b2..a092739b 100644
--- a/radicle/src/cob/thread.rs
+++ b/radicle/src/cob/thread.rs
@@ -12,7 +12,7 @@ use crate::cob::store;
use crate::cob::{History, TypeName};
use crate::crypto::Signer;
-use crdt::clock::LClock;
+use crdt::clock::Lamport;
use crdt::lwwreg::LWWReg;
use crdt::lwwset::LWWSet;
use crdt::redactable::Redactable;
@@ -72,9 +72,9 @@ pub struct Thread {
/// The comments under the thread.
comments: BTreeMap>,
/// Associated tags.
- tags: BTreeMap>,
+ tags: BTreeMap>,
/// Reactions to changes.
- reactions: BTreeMap>,
+ reactions: BTreeMap>,
}
impl store::FromHistory for Thread {
@@ -380,7 +380,7 @@ mod tests {
let mut changes = Vec::new();
let mut permutations: [Vec>; N] = array::from_fn(|_| Vec::new());
- let mut clock = LClock::default();
+ let mut clock = Lamport::default();
let author = ActorId::from([0; 32]);
for action in gen.take(g.size().min(8)) {