radicle: remove DelegatesOnly scope

The DelegatesOnly scope is very limited and causes more confusion than
it solves.

The Trusted scope subsumes DelegatesOnly since it implies delegates
along with any tracked nodes. This feels more natural to use and so
DelegatesOnly is removed -- leaving only Trusted and All.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny 2023-03-06 10:16:06 +00:00
parent 39be7db1e9
commit 5902236d0a
No known key found for this signature in database
GPG Key ID: 2552FB6F64066CB7
2 changed files with 2 additions and 7 deletions

View File

@ -309,8 +309,8 @@ mod test {
assert!(db.track_repo(&id, Scope::All).unwrap());
assert_eq!(db.repo_entry(&id).unwrap().unwrap().0, Scope::All);
assert!(db.track_repo(&id, Scope::DelegatesOnly).unwrap());
assert_eq!(db.repo_entry(&id).unwrap().unwrap().0, Scope::DelegatesOnly);
assert!(db.track_repo(&id, Scope::Trusted).unwrap());
assert_eq!(db.repo_entry(&id).unwrap().unwrap().0, Scope::Trusted);
}
#[test]

View File

@ -94,8 +94,6 @@ impl TryFrom<&sqlite::Value> for Policy {
pub enum Scope {
/// Track remotes of nodes that are already tracked.
Trusted,
/// Track remotes of repository delegates.
DelegatesOnly,
/// Track all remotes.
All,
}
@ -104,7 +102,6 @@ impl fmt::Display for Scope {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Scope::Trusted => f.write_str("trusted"),
Scope::DelegatesOnly => f.write_str("delegates-only"),
Scope::All => f.write_str("all"),
}
}
@ -120,7 +117,6 @@ impl FromStr for Scope {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"trusted" => Ok(Self::Trusted),
"delegates-only" => Ok(Self::DelegatesOnly),
"all" => Ok(Self::All),
_ => Err(ParseScopeError(s.to_string())),
}
@ -136,7 +132,6 @@ impl sqlite::BindableWithIndex for Scope {
) -> sqlite::Result<()> {
let s = match self {
Self::Trusted => "trusted",
Self::DelegatesOnly => "delegates-only",
Self::All => "all",
};
s.bind(stmt, i)