Skip to content

Commit 6aefe13

Browse files
Liu Yangmeta-codesync[bot]
authored andcommitted
Sync new derived data config to fbcode
Summary: ``` configerator-thrift-updater scm/mononoke/repos/repos.thrift ``` Then updated the relevant structs, implemented `is_readable` on the config. Reviewed By: YousefSalama Differential Revision: D92823961 fbshipit-source-id: 66ab8aa8f430d2706acec7429a8cd634fd231750
1 parent 0556ac7 commit 6aefe13

4 files changed

Lines changed: 28 additions & 1 deletion

File tree

configerator/structs/scm/mononoke/repos/repos.thrift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @generated SignedSource<<1b70216f1eec2c5ee90d2654ff35fec7>>
1+
// @generated SignedSource<<38ae52f7c1accd1259654be6a4722844>>
22
// DO NOT EDIT THIS FILE MANUALLY!
33
// This file is a mechanical copy of the version in the configerator repo. To
44
// modify it, edit the copy in the configerator repo instead and copy it over by
@@ -13,6 +13,10 @@
1313
*/
1414

1515
include "thrift/annotation/rust.thrift"
16+
include "thrift/annotation/thrift.thrift"
17+
18+
@thrift.AllowLegacyMissingUris
19+
package;
1620

1721
namespace py configerator.mononoke.repos
1822
namespace py3 mononoke.repos
@@ -554,6 +558,11 @@ struct RawDerivedDataConfig {
554558
9: optional string derivation_queue_scuba_table;
555559
10: optional RawRemoteDerivationConfig remote_derivation_config;
556560
11: optional RawDerivedDataBlockedDerivation blocked_derivation;
561+
// There are cases where a type is selectively backfilled for a certain repo
562+
// but not enabled for general derivation for new incoming commits,
563+
// e.g. inferred_copy_from in fbsource (https://fburl.com/workplace/pic8groe)
564+
// This option is meant to capture that.
565+
12: optional set<string> extra_types_available_for_read;
557566
}
558567

559568
@rust.Exhaustive

eden/mononoke/metaconfig/parser/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,7 @@ mod test {
13551355
blocked_derivation: hashmap! {
13561356
THREES_CSID => Some(hashset! { DerivableType::Unodes, }),
13571357
},
1358+
extra_types_available_for_read: hashset! {},
13581359
},
13591360
enforce_lfs_acl_check: false,
13601361
repo_client_use_warm_bookmarks_cache: true,

eden/mononoke/metaconfig/parser/src/convert/repo.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,12 @@ impl Convert for RawDerivedDataConfig {
643643
.map(|blocked_derivation| blocked_derivation.convert())
644644
.transpose()?
645645
.unwrap_or_default(),
646+
extra_types_available_for_read: self
647+
.extra_types_available_for_read
648+
.unwrap_or_default()
649+
.into_iter()
650+
.map(|s| DerivableType::from_name(&s))
651+
.collect::<Result<_, _>>()?,
646652
})
647653
}
648654
}

eden/mononoke/metaconfig/types/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ pub struct DerivedDataConfig {
386386

387387
/// Commits with blocked derivation
388388
pub blocked_derivation: HashMap<ChangesetId, Option<HashSet<DerivableType>>>,
389+
390+
/// Extra derived data types that are available for read but not necessarily enabled for derivation.
391+
pub extra_types_available_for_read: HashSet<DerivableType>,
389392
}
390393

391394
impl DerivedDataConfig {
@@ -436,6 +439,14 @@ impl DerivedDataConfig {
436439
.is_none_or(|types| types.contains(&derivable_type))
437440
})
438441
}
442+
443+
/// Returns whether the named derived data type is readable.
444+
/// A type is readable if it's either in the active config's types or in extra_types_available_for_read.
445+
pub fn is_readable(&self, derivable_type: DerivableType) -> bool {
446+
self.extra_types_available_for_read
447+
.contains(&derivable_type)
448+
|| self.is_enabled(derivable_type)
449+
}
439450
}
440451

441452
/// Config for derived data types

0 commit comments

Comments
 (0)