mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
segmented_changelog: introduce SegmentedChangelog::pull_fast_forward_master
Summary: The naming is used in other parts of dag crate - this introduce mononoke side binding for corresponding functions on dag side Reviewed By: quark-zju Differential Revision: D29318722 fbshipit-source-id: e9eea5536b041b6ab2ce578914817bca43a10d48
This commit is contained in:
parent
c37c61cc0d
commit
b13454d54b
@ -80,6 +80,17 @@ impl SegmentedChangelog for DisabledSegmentedChangelog {
|
||||
))
|
||||
}
|
||||
|
||||
async fn pull_fast_forward_master(
|
||||
&self,
|
||||
_ctx: &CoreContext,
|
||||
_old_master: ChangesetId,
|
||||
_new_master: ChangesetId,
|
||||
) -> Result<CloneData<ChangesetId>> {
|
||||
Err(format_err!(
|
||||
"Segmented Changelog is not enabled for this repo",
|
||||
))
|
||||
}
|
||||
|
||||
async fn full_idmap_clone_data(
|
||||
&self,
|
||||
_ctx: &CoreContext,
|
||||
@ -127,6 +138,16 @@ macro_rules! segmented_changelog_delegate {
|
||||
delegate.clone_data($ctx).await
|
||||
}
|
||||
|
||||
async fn pull_fast_forward_master(
|
||||
&$self,
|
||||
$ctx: &CoreContext,
|
||||
old_master: ChangesetId,
|
||||
new_master: ChangesetId,
|
||||
) -> Result<CloneData<ChangesetId>> {
|
||||
let delegate = $delegate;
|
||||
delegate.pull_fast_forward_master($ctx, old_master, new_master).await
|
||||
}
|
||||
|
||||
async fn full_idmap_clone_data(
|
||||
&$self,
|
||||
$ctx: &CoreContext,
|
||||
|
@ -390,6 +390,20 @@ impl SegmentedChangelog for OnDemandUpdateSegmentedChangelog {
|
||||
read_dag.clone_data(ctx).await
|
||||
}
|
||||
|
||||
async fn pull_fast_forward_master(
|
||||
&self,
|
||||
ctx: &CoreContext,
|
||||
old_master: ChangesetId,
|
||||
new_master: ChangesetId,
|
||||
) -> Result<CloneData<ChangesetId>> {
|
||||
// Might need to wait here for segmented changelog to catch up
|
||||
let iddag = self.iddag.read().await;
|
||||
let read_dag = ReadOnlySegmentedChangelog::new(&iddag, self.idmap.clone());
|
||||
read_dag
|
||||
.pull_fast_forward_master(ctx, old_master, new_master)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn full_idmap_clone_data(
|
||||
&self,
|
||||
ctx: &CoreContext,
|
||||
|
@ -138,6 +138,15 @@ impl<'a> SegmentedChangelog for ReadOnlySegmentedChangelog<'a> {
|
||||
Ok(clone_data)
|
||||
}
|
||||
|
||||
async fn pull_fast_forward_master(
|
||||
&self,
|
||||
_ctx: &CoreContext,
|
||||
_old_master: ChangesetId,
|
||||
_new_master: ChangesetId,
|
||||
) -> Result<CloneData<ChangesetId>> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
async fn full_idmap_clone_data(
|
||||
&self,
|
||||
ctx: &CoreContext,
|
||||
|
@ -104,6 +104,14 @@ pub trait SegmentedChangelog: Send + Sync {
|
||||
/// only needs one head.
|
||||
async fn clone_data(&self, ctx: &CoreContext) -> Result<CloneData<ChangesetId>>;
|
||||
|
||||
/// Uses segmented changelog fast forward master pull fastpath.
|
||||
async fn pull_fast_forward_master(
|
||||
&self,
|
||||
ctx: &CoreContext,
|
||||
old_master: ChangesetId,
|
||||
new_master: ChangesetId,
|
||||
) -> Result<CloneData<ChangesetId>>;
|
||||
|
||||
/// An intermediate step in the quest for Segmented Changelog clones requires the server to
|
||||
/// send over the full idmap. For every commit (in master) we send the id that it corresponds
|
||||
/// to in the iddag.
|
||||
|
Loading…
Reference in New Issue
Block a user