Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle: Add comments for block and is_blocked
Fintan Halpenny committed 2 months ago
commit c8252033e82eca3a0922b09573e3d148727e0a34
parent 8d4f50c18e97fc5b3eefeb47906bfe2689585243
2 files changed +3 -0
modified crates/radicle/src/node.rs
@@ -907,6 +907,7 @@ pub trait Handle: Clone + Sync + Send {
    fn seed(&mut self, id: RepoId, scope: policy::Scope) -> Result<bool, Self::Error>;
    /// Start following the given peer.
    fn follow(&mut self, id: NodeId, alias: Option<Alias>) -> Result<bool, Self::Error>;
+
    /// Set the following policy to block for the given peer.
    fn block(&mut self, id: NodeId) -> Result<bool, Self::Error>;
    /// Un-seed the given repo and delete it from storage.
    fn unseed(&mut self, id: RepoId) -> Result<bool, Self::Error>;
modified crates/radicle/src/node/policy/store.rs
@@ -249,6 +249,8 @@ impl<T> Store<T> {
        ))
    }

+
    /// Returns `true` if there is a follow policy for the given node, and that
+
    /// policy is [`Policy::Block`].
    pub fn is_blocked(&self, id: &NodeId) -> Result<bool, Error> {
        Ok(matches!(
            self.follow_policy(id)?,