Skip to content

Commit

Permalink
Replication Improvements
Browse files Browse the repository at this point in the history
The reason for this set of changes stemmed from replication missing some
references that were expected to be present. This lead us to exploring a
different way of organising the replication.

The change introduces:
* Separate replication types: clone and fetch
* A clone is a fresh fetch from the remote where we fetch all the
necessary data and prune after
* A fetch is fetching the remotes we're already aware of and updating
the identity based on that information.
* Our verification now ensures that all identities are verified, are not
forks, and then we adopt the latest tip from the delegates.
* We add a configurable limit to fetching so that we can tune how much
data we're allowing to be fetched from a remote.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
  • Loading branch information
FintanH committed Jan 25, 2021
1 parent 7e4ee18 commit 087a1bf
Show file tree
Hide file tree
Showing 14 changed files with 1,286 additions and 266 deletions.
7 changes: 7 additions & 0 deletions git-ext/src/reference/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,13 @@ impl Display for Qualified {
pub struct RefspecPattern(PathBuf);

impl RefspecPattern {
/// Append the `RefLike` to the `RefspecPattern`. This allows the creation
/// of patterns where the `*` appears in the middle of the path, e.g.
/// `refs/remotes/*/mfdoom`
pub fn append(&self, refl: impl Into<RefLike>) -> Self {
RefspecPattern(self.0.join(refl.into()))
}

pub fn as_str(&self) -> &str {
self.as_ref()
}
Expand Down
13 changes: 9 additions & 4 deletions librad-test/src/rad/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ where
let gossip_params = Default::default();
let disco = seeds.into_iter().collect::<discovery::Static>();
let storage_config = Default::default();
let fetch_limit = Default::default();
let network = Default::default();

git::storage::Storage::init(&paths, key.clone())?;
Expand All @@ -74,15 +75,19 @@ where
listen_addr,
gossip_params,
storage_config,
fetch_limit,
network,
};

Peer::bootstrap(config, disco)
.await
.map(|peer| TestPeer {
_tmp: tmp,
peer,
key,
.map(|peer| {
tracing::debug!(path = %tmp.path().display(), peer_id = %peer.peer_id(), "setting up peer");
TestPeer {
_tmp: tmp,
peer,
key,
}
})
.map_err(|e| e.into())
}
Expand Down
Loading

0 comments on commit 087a1bf

Please sign in to comment.