Allow arbitrary packs

Summary:
The limitation to two types is arbitrary and limiting. Instead, we want to be able to create as many cache artifacts as is sensible to improve the caching behaviour.

A lot of unnecessary cloning in here. I might optimise this a bit in the future but it's not really perf critical as this is highly I/O bound.

Reviewed By: lblasa

Differential Revision: D38155922

fbshipit-source-id: 78b86ebff54269c5049e59197f1c25fedfad0111
This commit is contained in:
Pascal Hartig
2022-07-27 07:43:12 -07:00
committed by Facebook GitHub Bot
parent d73387d80b
commit 6913d6f653
3 changed files with 24 additions and 18 deletions

View File

@@ -29,7 +29,6 @@ impl Display for Platform {
#[derive(
Debug,
Clone,
Copy,
PartialEq,
Eq,
PartialOrd,
@@ -38,9 +37,13 @@ impl Display for Platform {
serde::Serialize
)]
#[serde(rename_all = "lowercase")]
pub enum PackType {
Frameworks,
Core,
pub struct PackType(String);
#[cfg(test)]
impl PackType {
pub fn new(s: &str) -> Self {
Self(s.to_string())
}
}
#[derive(
@@ -65,10 +68,7 @@ pub enum PackMode {
impl Display for PackType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Self::Frameworks => write!(f, "frameworks"),
Self::Core => write!(f, "core"),
}
write!(f, "{}", self.0)
}
}