Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
crdt: Remove redundant `Author` type
Alexis Sellier committed 3 years ago
commit b79e2f5b5627ada642528431e481a027e4ce77dc
parent d18b67ba21c33ec7ef0bfa7febb9546a242e8f00
2 files changed +5 -9
modified radicle-crdt/src/change.rs
@@ -6,10 +6,8 @@ use serde::{Deserialize, Serialize};
use crate::clock::LClock;

/// Identifies a change.
-
pub type ChangeId = (LClock, Author);
+
pub type ChangeId = (LClock, ActorId);
/// The author of a change.
-
pub type Author = PublicKey;
-
/// Alias for `Author`.
pub type ActorId = PublicKey;

/// The `Change` is the unit of replication.
@@ -20,7 +18,7 @@ pub struct Change<A> {
    /// The action carried out by this change.
    pub action: A,
    /// The author of the change.
-
    pub author: Author,
+
    pub author: ActorId,
    /// Lamport clock.
    pub clock: LClock,
}
modified radicle/src/cob/thread.rs
@@ -10,20 +10,18 @@ use serde::{Deserialize, Serialize};
use crate::cob::common::{Reaction, Tag};
use crate::cob::store;
use crate::cob::{History, TypeName};
-
use crate::crypto::{PublicKey, Signer};
+
use crate::crypto::Signer;

use crdt::clock::LClock;
use crdt::lwwreg::LWWReg;
use crdt::lwwset::LWWSet;
use crdt::redactable::Redactable;
-
use crdt::{Change, ChangeId, Semilattice};
+
use crdt::{ActorId, Change, ChangeId, Semilattice};

/// Type name of a thread.
pub static TYPENAME: Lazy<TypeName> =
    Lazy::new(|| FromStr::from_str("xyz.radicle.thread").expect("type name is valid"));

-
/// Alias for `Author`.
-
pub type ActorId = PublicKey;
/// Identifies a comment.
pub type CommentId = ChangeId;

@@ -383,7 +381,7 @@ mod tests {
            let mut changes = Vec::new();
            let mut permutations: [Vec<Change<Action>>; N] = array::from_fn(|_| Vec::new());
            let mut clock = LClock::default();
-
            let author = PublicKey::from([0; 32]);
+
            let author = ActorId::from([0; 32]);

            for action in gen.take(g.size().min(8)) {
                let clock = clock.tick();