mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
scs_server: support preparation of derived data in create stack
Summary: When creating a stack, make it possible to request that a derived data type is prepared as part of creating the stack. Since the data for the stack is in local cache, this should be faster than it would otherwise be. This is a simple initial implementation. It requires that the data is already derived for the parents of the stack, and does not support parallel derivation of the different types, nor types that include interdependencies. In fact, we only support fsnodes and skeleton manifests right now. Differential Revision: D45216982 fbshipit-source-id: c6ca7b265b1e6219a1193c51d0a984794aa34965
This commit is contained in:
parent
dd66bf21dd
commit
62d92b31f0
@ -918,6 +918,11 @@ struct RepoCreateStackParams {
|
||||
/// The parents of the first commit in the stack.
|
||||
2: list<CommitId> parents;
|
||||
|
||||
/// Optional set of derived data types to derive for the newly created
|
||||
/// commits in preparation of future operations. Derivation for the parents
|
||||
/// must already be complete.
|
||||
3: optional set<DerivedDataType> prepare_derived_data_types;
|
||||
|
||||
/// Commit identity schemes to return.
|
||||
4: set<CommitIdentityScheme> identity_schemes;
|
||||
|
||||
|
@ -489,6 +489,17 @@ impl SourceControlServiceImpl {
|
||||
.create_changeset_stack(stack_parents, info_stack, changes_stack, bubble)
|
||||
.await?;
|
||||
|
||||
// Prepare derived data if we were asked to. Simple implementation
|
||||
// that doesn't support parallel derivation or dependencies between types.
|
||||
if let Some(prepare_types) = ¶ms.prepare_derived_data_types {
|
||||
let csids = stack.iter().map(|c| c.id()).collect::<Vec<_>>();
|
||||
for derived_data_type in prepare_types {
|
||||
let derivable_type = DerivableType::from_request(derived_data_type)?;
|
||||
repo.prepare_derived_data(derivable_type, csids.clone())
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
// If you ask for a git identity back, then we'll assume that you supplied one to us
|
||||
// and set it. Later, when we can derive a git commit hash, this'll become more
|
||||
// open, because we'll only do the check if you ask for a hash different to the
|
||||
|
Loading…
Reference in New Issue
Block a user