radicle-link
radicle-link copied to clipboard
Address eager fetch TODO
I think we can actually fix the TODO: if we only check is_tracked
, we'll also fetch if we haven't yet fetched any data from the tracked peer.
Originally posted by @kim in https://github.com/radicle-dev/radicle-link/pull/297#discussion_r482920516
@kim if we look at the TODO, I am not sure what exactly we need to do to "fetch eagerly", given that we seem to fetch as early as we can, i.e., when we have a rev and a tracked (urn, peer).
https://github.com/radicle-dev/radicle-link/blob/7a423dac00e5a8fdacf16038cfdbfb7245208388/librad/src/net/peer.rs#L448-L463
Note that the head
is only used to check that we already have it. We fetch regardless is it doesn't exist.
Could it be that if we track offline that we need to clone eagerly?
Could it be that if we track offline that we need to clone eagerly?
Yeah true, there are two different cases:
- We have cloned already (or created the repo ourselves), and tracked an additional peer, but haven't fetched anything from it yet
For this case, we need to fetch if we find the (Urn, PeerId) in our remotes, instead of returning PutResult::Uninteresting. This should've been included in #297.
- We tracked an arbitrary (Urn, Peer), but haven't cloned (ie. the namespace doesn't exist)
In this case, we need to clone instead of fetch. Note that this can fail to pass verification, so we need to think about how to handle that -- we don't want to retry cloning indefinitely, so we should probably remove the remote. Unfortunately, this is not interactive, so we need some channel to notify the user.