mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
move Send + Sync to the trait for LeastCommonAncestorsHint
Summary: This hint is passed to many places, so it reduces the code. Reviewed By: StanislavGlebik Differential Revision: D13802159 fbshipit-source-id: 891eef00c236b2241571e24c50dc82b9862872cc
This commit is contained in:
parent
6466a8806e
commit
abe70d4324
@ -29,7 +29,7 @@ pub fn create_getbundle_response(
|
||||
blobrepo: BlobRepo,
|
||||
common: Vec<HgChangesetId>,
|
||||
heads: Vec<HgChangesetId>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint>,
|
||||
phases_hint: Option<Arc<Phases>>,
|
||||
) -> Result<Vec<PartEncodeBuilder>> {
|
||||
if common.is_empty() {
|
||||
|
@ -62,7 +62,7 @@ pub fn resolve(
|
||||
_heads: Vec<String>,
|
||||
bundle2: BoxStream<Bundle2Item, Error>,
|
||||
hook_manager: Arc<HookManager>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint>,
|
||||
phases_hint: Arc<Phases>,
|
||||
) -> BoxFuture<Bytes, Error> {
|
||||
let resolver = Bundle2Resolver::new(ctx.clone(), repo, pushrebase, hook_manager);
|
||||
@ -201,7 +201,7 @@ fn resolve_pushrebase(
|
||||
commonheads: CommonHeads,
|
||||
resolver: Bundle2Resolver,
|
||||
bundle2: BoxStream<Bundle2Item, Error>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint>,
|
||||
phases_hint: Arc<Phases>,
|
||||
) -> BoxFuture<Bytes, Error> {
|
||||
resolver
|
||||
@ -840,7 +840,7 @@ impl Bundle2Resolver {
|
||||
commonheads: CommonHeads,
|
||||
pushrebased_rev: ChangesetId,
|
||||
onto: Bookmark,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint>,
|
||||
phases_hint: Arc<Phases>,
|
||||
) -> impl Future<Item = Bytes, Error = Error> {
|
||||
// Send to the client both pushrebased commit and current "onto" bookmark. Normally they
|
||||
|
@ -130,7 +130,7 @@ pub trait ReachabilityIndex {
|
||||
}
|
||||
|
||||
/// Trait for any method supporting computing an "LCA hint"
|
||||
pub trait LeastCommonAncestorsHint {
|
||||
pub trait LeastCommonAncestorsHint: Send + Sync {
|
||||
/// Return a Future for an advanced frontier of ancestors from a set of nodes.
|
||||
/// Given a set "nodes", and a maximum generation "gen",
|
||||
/// return a set of nodes "C" which satisfies:
|
||||
|
@ -196,7 +196,7 @@ pub struct RepoClient {
|
||||
// Percent of returned entries (filelogs, manifests, changesets) which content
|
||||
// will be hash validated
|
||||
hash_validation_percentage: usize,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint>,
|
||||
phases_hint: Arc<Phases>,
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ impl RepoClient {
|
||||
repo: MononokeRepo,
|
||||
ctx: CoreContext,
|
||||
hash_validation_percentage: usize,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint: Arc<LeastCommonAncestorsHint>,
|
||||
phases_hint: Arc<Phases>,
|
||||
) -> Self {
|
||||
RepoClient {
|
||||
|
@ -89,7 +89,7 @@ pub struct DifferenceOfUnionsOfAncestorsNodeStream {
|
||||
// - Max generation number in "C" is <= gen
|
||||
// - Any ancestor of "nodes" with generation <= gen is also an ancestor of "C"
|
||||
// It's used to move `exclude` NodeFrontier
|
||||
lca_hint_index: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint_index: Arc<LeastCommonAncestorsHint>,
|
||||
|
||||
// Nodes that we know about, grouped by generation.
|
||||
next_generation: BTreeMap<Generation, HashSet<ChangesetId>>,
|
||||
@ -149,7 +149,7 @@ impl DifferenceOfUnionsOfAncestorsNodeStream {
|
||||
pub fn new(
|
||||
ctx: CoreContext,
|
||||
changeset_fetcher: &Arc<ChangesetFetcher>,
|
||||
lca_hint_index: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint_index: Arc<LeastCommonAncestorsHint>,
|
||||
hash: ChangesetId,
|
||||
) -> Box<BonsaiNodeStream> {
|
||||
Self::new_with_excludes(ctx, changeset_fetcher, lca_hint_index, vec![hash], vec![])
|
||||
@ -158,7 +158,7 @@ impl DifferenceOfUnionsOfAncestorsNodeStream {
|
||||
pub fn new_union(
|
||||
ctx: CoreContext,
|
||||
changeset_fetcher: &Arc<ChangesetFetcher>,
|
||||
lca_hint_index: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint_index: Arc<LeastCommonAncestorsHint>,
|
||||
hashes: Vec<ChangesetId>,
|
||||
) -> Box<BonsaiNodeStream> {
|
||||
Self::new_with_excludes(ctx, changeset_fetcher, lca_hint_index, hashes, vec![])
|
||||
@ -167,7 +167,7 @@ impl DifferenceOfUnionsOfAncestorsNodeStream {
|
||||
pub fn new_with_excludes(
|
||||
ctx: CoreContext,
|
||||
changeset_fetcher: &Arc<ChangesetFetcher>,
|
||||
lca_hint_index: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
lca_hint_index: Arc<LeastCommonAncestorsHint>,
|
||||
hashes: Vec<ChangesetId>,
|
||||
excludes: Vec<ChangesetId>,
|
||||
) -> Box<BonsaiNodeStream> {
|
||||
|
@ -35,7 +35,7 @@ pub struct RepoHandler {
|
||||
pub wireproto_scribe_category: Option<String>,
|
||||
pub repo: MononokeRepo,
|
||||
pub hash_validation_percentage: usize,
|
||||
pub lca_hint: Arc<LeastCommonAncestorsHint + Send + Sync>,
|
||||
pub lca_hint: Arc<LeastCommonAncestorsHint>,
|
||||
pub phases_hint: Arc<Phases>,
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ pub fn repo_handlers(
|
||||
};
|
||||
|
||||
// initialize lca hint from the skip index
|
||||
let lca_hint: Arc<LeastCommonAncestorsHint + Send + Sync> = skip_index;
|
||||
let lca_hint: Arc<LeastCommonAncestorsHint> = skip_index;
|
||||
|
||||
(
|
||||
reponame,
|
||||
|
Loading…
Reference in New Issue
Block a user