cli: Changed the default scope from all to followed for clone and seed
The previous implementation used 'all' as the default for scope, this could lead to surprising behaviour where a user would fetch all references for cloned and seeded repositories. Instead have a progressive, safe by default value - where it fetches only 'followed' references. Later a user can decide to set the scope to 'all'. NOTE: the default policy scope was not changed from 'all' and is intended to be changed at a later date.
This commit is contained in:
parent
dd13eed1d0
commit
0684d1ccdf
|
|
@ -3,7 +3,7 @@ automatically connect to the necessary seeds.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all'
|
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed'
|
||||||
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
|
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
✓ Creating checkout in ./heartwood..
|
✓ Creating checkout in ./heartwood..
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,13 @@ $ rad node routing
|
||||||
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │
|
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │
|
||||||
╰──────────────────────────────────────────────────────────────────────────────────────╯
|
╰──────────────────────────────────────────────────────────────────────────────────────╯
|
||||||
```
|
```
|
||||||
|
|
||||||
When she tries to clone, one of those will fail to fetch. But the clone command
|
When she tries to clone, one of those will fail to fetch. But the clone command
|
||||||
still returns successfully.
|
still returns successfully.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --timeout 3
|
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --timeout 3
|
||||||
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all'
|
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed'
|
||||||
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 3 potential seed(s).
|
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 3 potential seed(s).
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
✓ Creating checkout in ./heartwood..
|
✓ Creating checkout in ./heartwood..
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ To create a local copy of a repository on the radicle network, we use the
|
||||||
`clone` command, followed by the identifier or *RID* of the repository:
|
`clone` command, followed by the identifier or *RID* of the repository:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --scope followed
|
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed'
|
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed'
|
||||||
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found [..] potential seed(s).
|
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found [..] potential seed(s).
|
||||||
✓ Target met: [..] seed(s)
|
✓ Target met: [..] seed(s)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ have to update our seeding policy for the project.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ rad seed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --no-fetch
|
$ rad seed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --no-fetch
|
||||||
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all'
|
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed'
|
||||||
```
|
```
|
||||||
|
|
||||||
Now that the project is seeding we can fetch it and we will have it in
|
Now that the project is seeding we can fetch it and we will have it in
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ sync` and fetch his references:
|
||||||
|
|
||||||
``` ~bob
|
``` ~bob
|
||||||
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all'
|
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed'
|
||||||
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
|
Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s).
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
✓ Creating checkout in ./heartwood..
|
✓ Creating checkout in ./heartwood..
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ If we then seed it, it becomes advertised in our inventory:
|
||||||
```
|
```
|
||||||
$ rad seed rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK
|
$ rad seed rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK
|
||||||
✓ Inventory updated with rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK
|
✓ Inventory updated with rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK
|
||||||
✓ Seeding policy updated for rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK with scope 'all'
|
✓ Seeding policy updated for rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK with scope 'followed'
|
||||||
```
|
```
|
||||||
```
|
```
|
||||||
$ rad node inventory
|
$ rad node inventory
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ $ rad inspect --identity
|
||||||
``` ~bob
|
``` ~bob
|
||||||
$ rad ls --all --private
|
$ rad ls --all --private
|
||||||
$ rad clone rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1
|
$ rad clone rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1
|
||||||
✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all'
|
✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'followed'
|
||||||
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
|
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
|
||||||
✓ Target met: 1 preferred seed(s).
|
✓ Target met: 1 preferred seed(s).
|
||||||
✓ Creating checkout in ./heartwood..
|
✓ Creating checkout in ./heartwood..
|
||||||
|
|
@ -49,7 +49,7 @@ We can also use `rad seed` to seed and fetch without creating a checkout.
|
||||||
|
|
||||||
``` ~bob
|
``` ~bob
|
||||||
$ rad seed rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1
|
$ rad seed rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1
|
||||||
✓ Seeding policy exists for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all'
|
✓ Seeding policy exists for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'followed'
|
||||||
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
|
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ $ rad ls
|
||||||
```
|
```
|
||||||
``` ~bob (fail)
|
``` ~bob (fail)
|
||||||
$ rad clone rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1
|
$ rad clone rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1
|
||||||
✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all'
|
✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'followed'
|
||||||
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
|
Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s).
|
||||||
✗ Target not met: could not fetch from [z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi], and required 1 more seed(s)
|
✗ Target not met: could not fetch from [z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi], and required 1 more seed(s)
|
||||||
! Warning: Failed to fetch from 1 seed(s).
|
! Warning: Failed to fetch from 1 seed(s).
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ We can decide to seed it later, so that others can fetch it from us, given
|
||||||
that they are part of the allow list:
|
that they are part of the allow list:
|
||||||
```
|
```
|
||||||
$ rad seed rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu
|
$ rad seed rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu
|
||||||
✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all'
|
✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'followed'
|
||||||
```
|
```
|
||||||
|
|
||||||
But it still won't show up in our inventory, since it's private:
|
But it still won't show up in our inventory, since it's private:
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ up in our inventory:
|
||||||
```
|
```
|
||||||
$ rad seed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
$ rad seed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
✓ Inventory updated with rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
✓ Inventory updated with rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all'
|
✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed'
|
||||||
$ rad node inventory
|
$ rad node inventory
|
||||||
rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ To push changes, run `git push`.
|
||||||
|
|
||||||
``` ~bob
|
``` ~bob
|
||||||
$ rad clone rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK
|
$ rad clone rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK
|
||||||
✓ Seeding policy updated for rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK with scope 'all'
|
✓ Seeding policy updated for rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK with scope 'followed'
|
||||||
Fetching rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK from the network, found 1 potential seed(s).
|
Fetching rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK from the network, found 1 potential seed(s).
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
✓ Creating checkout in ./heartwood..
|
✓ Creating checkout in ./heartwood..
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ is used):
|
||||||
|
|
||||||
```
|
```
|
||||||
$ rad seed rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm
|
$ rad seed rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm
|
||||||
✓ Seeding policy updated for rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW with scope 'all'
|
✓ Seeding policy updated for rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW with scope 'followed'
|
||||||
Fetching rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW from the network, found 1 potential seed(s).
|
Fetching rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW from the network, found 1 potential seed(s).
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
✓ Seeding policy updated for rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm with scope 'all'
|
✓ Seeding policy updated for rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm with scope 'followed'
|
||||||
Fetching rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm from the network, found 1 potential seed(s).
|
Fetching rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm from the network, found 1 potential seed(s).
|
||||||
✓ Target met: 1 seed(s)
|
✓ Target met: 1 seed(s)
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,5 @@ Note that seeding works fine without a running node:
|
||||||
|
|
||||||
``` ~alice
|
``` ~alice
|
||||||
$ rad seed rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
|
$ rad seed rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
|
||||||
✓ Seeding policy updated for rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 with scope 'all'
|
✓ Seeding policy updated for rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 with scope 'followed'
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ It's also possible to receive an error if a repository is not found anywhere.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ rad seed rad:z39mP9rQAaGmERfUMPULfPUi473tY --no-fetch
|
$ rad seed rad:z39mP9rQAaGmERfUMPULfPUi473tY --no-fetch
|
||||||
✓ Seeding policy updated for rad:z39mP9rQAaGmERfUMPULfPUi473tY with scope 'all'
|
✓ Seeding policy updated for rad:z39mP9rQAaGmERfUMPULfPUi473tY with scope 'followed'
|
||||||
```
|
```
|
||||||
``` (fail)
|
``` (fail)
|
||||||
$ rad sync rad:z39mP9rQAaGmERfUMPULfPUi473tY
|
$ rad sync rad:z39mP9rQAaGmERfUMPULfPUi473tY
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ pub struct Args {
|
||||||
/// Follow scope
|
/// Follow scope
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
default_value_t = Scope::All,
|
default_value_t = Scope::Followed,
|
||||||
value_parser = terminal::args::ScopeParser
|
value_parser = terminal::args::ScopeParser
|
||||||
)]
|
)]
|
||||||
pub(super) scope: Scope,
|
pub(super) scope: Scope,
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ pub struct Args {
|
||||||
/// Peer follow scope for this repository
|
/// Peer follow scope for this repository
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
default_value_t = Scope::All,
|
default_value_t = Scope::Followed,
|
||||||
value_parser = terminal::args::ScopeParser
|
value_parser = terminal::args::ScopeParser
|
||||||
)]
|
)]
|
||||||
pub(super) scope: Scope,
|
pub(super) scope: Scope,
|
||||||
|
|
|
||||||
|
|
@ -572,6 +572,7 @@ fn rad_id_multi_delegate() {
|
||||||
|
|
||||||
alice.handle.seed(acme, Scope::All).unwrap();
|
alice.handle.seed(acme, Scope::All).unwrap();
|
||||||
bob.handle.follow(eve.id, None).unwrap();
|
bob.handle.follow(eve.id, None).unwrap();
|
||||||
|
eve.handle.follow(bob.id, None).unwrap();
|
||||||
alice.connect(&bob).converge([&bob]);
|
alice.connect(&bob).converge([&bob]);
|
||||||
eve.connect(&alice).converge([&alice]);
|
eve.connect(&alice).converge([&alice]);
|
||||||
|
|
||||||
|
|
@ -2060,17 +2061,19 @@ fn rad_remote() {
|
||||||
.handle
|
.handle
|
||||||
.follow(bob.id, Some(Alias::new("bob")))
|
.follow(bob.id, Some(Alias::new("bob")))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
alice
|
||||||
|
.handle
|
||||||
|
.follow(eve.id, Some(Alias::new("eve")))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
bob.connect(&alice);
|
bob.connect(&alice);
|
||||||
bob.routes_to(&[(rid, alice.id)]);
|
bob.routes_to(&[(rid, alice.id)]);
|
||||||
bob.fork(rid, bob.home.path()).unwrap();
|
bob.fork(rid, bob.home.path()).unwrap();
|
||||||
bob.announce(rid, 2, bob.home.path()).unwrap();
|
|
||||||
alice.has_remote_of(&rid, &bob.id);
|
alice.has_remote_of(&rid, &bob.id);
|
||||||
|
|
||||||
eve.connect(&bob);
|
eve.connect(&alice);
|
||||||
eve.routes_to(&[(rid, alice.id)]);
|
eve.routes_to(&[(rid, alice.id)]);
|
||||||
eve.fork(rid, eve.home.path()).unwrap();
|
eve.fork(rid, eve.home.path()).unwrap();
|
||||||
eve.announce(rid, 2, eve.home.path()).unwrap();
|
|
||||||
alice.has_remote_of(&rid, &eve.id);
|
alice.has_remote_of(&rid, &eve.id);
|
||||||
|
|
||||||
test(
|
test(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue