Add Thrift files synced from configerator

Summary: D59264927 enables the automatic sync of these files; this diff adds TARGETS files and verifies everything works.

Reviewed By: RajivTS

Differential Revision: D59265101

fbshipit-source-id: 5efc2d423b146ca533762a8f7feafa4c8ab9b8b4
This commit is contained in:
Andrea Campi 2024-07-03 03:04:23 -07:00 committed by Facebook GitHub Bot
parent 59dde67e9e
commit d7d8bebbea
28 changed files with 696 additions and 0 deletions

View File

@ -0,0 +1,34 @@
# @generated by autocargo from //configerator/structs/scm/mononoke/constants:constants-rust
[package]
name = "constants"
version = "0.1.0"
authors = ["Facebook"]
edition = "2021"
license = "GPLv2+"
build = "thrift_build.rs"
[lib]
path = "thrift_lib.rs"
test = false
doctest = false
doc = false
[dependencies]
anyhow = "1.0.75"
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
futures = { version = "0.3.30", features = ["async-await", "compat"] }
once_cell = "1.12"
ref-cast = "1.0.18"
serde = { version = "1.0.185", features = ["derive", "rc"] }
serde_derive = "1.0.185"
sharding = { version = "0.1.0", path = "../sharding" }
thiserror = "1.0.49"
[build-dependencies]
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
[features]
default = ["thrift_library_unittests_disabled"]
thrift_library_unittests_disabled = []

View File

@ -0,0 +1,18 @@
load("@fbcode_macros//build_defs:thrift_library.bzl", "thrift_library")
oncall("source_control")
thrift_library(
name = "constants",
languages = [
"py",
"rust",
],
py_base_module = "configerator.mononoke",
thrift_py_options = "json",
thrift_rust_options = "serde",
thrift_srcs = {"constants.thrift": None},
deps = [
"//configerator/structs/scm/mononoke/sharding:sharding",
],
)

View File

@ -0,0 +1,30 @@
# @generated by autocargo from //configerator/structs/scm/mononoke/constants:constants-rust-clients
[package]
name = "constants_clients"
version = "0.1.0"
authors = ["Facebook"]
edition = "2021"
license = "GPLv2+"
build = "thrift_build.rs"
[lib]
path = "thrift_lib.rs"
test = false
doctest = false
doc = false
[dependencies]
anyhow = "1.0.75"
async-trait = "0.1.71"
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
const-cstr = "0.3.0"
constants__types = { package = "constants", version = "0.1.0", path = ".." }
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
futures = { version = "0.3.30", features = ["async-await", "compat"] }
sharding = { version = "0.1.0", path = "../../sharding" }
sharding_clients = { version = "0.1.0", path = "../../sharding/clients" }
tracing = { version = "0.1.40", features = ["attributes", "valuable"] }
[build-dependencies]
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }

View File

@ -0,0 +1,26 @@
// @generated by autocargo
use std::env;
use std::fs;
use std::path::Path;
use thrift_compiler::Config;
use thrift_compiler::GenContext;
const CRATEMAP: &str = "\
configerator/structs/scm/mononoke/constants/constants.thrift crate //configerator/structs/scm/mononoke/constants:constants-rust
configerator/structs/scm/mononoke/sharding/sharding.thrift sharding //configerator/structs/scm/mononoke/sharding:sharding-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
Config::from_env(GenContext::Clients)
.expect("Failed to instantiate thrift_compiler::Config")
.base_path("../../../../../..")
.types_crate("constants__types")
.clients_crate("constants__clients")
.options("serde")
.run(["../constants.thrift"])
.expect("Failed while running thrift compilation");
}

View File

@ -0,0 +1,3 @@
// @generated by autocargo
::codegen_includer_proc_macro::include!();

View File

@ -0,0 +1,32 @@
// @generated SignedSource<<38fd8790e28b7e54d6e4b208d2394138>>
// DO NOT EDIT THIS FILE MANUALLY!
// This file is a mechanical copy of the version in the configerator repo. To
// modify it, edit the copy in the configerator repo instead and copy it over by
// running the following in your fbcode directory:
//
// configerator-thrift-updater scm/mononoke/constants/constants.thrift
namespace py configerator.mononoke.constants
namespace py3 mononoke.constants
include "configerator/structs/scm/mononoke/sharding/sharding.thrift"
struct Constants {
1: map<string, Region> regions;
}
struct Region {
// The human-friendly name, e.g. "ash"
1: string name;
// The number of tasks to run in this region, e.g. 12
2: optional i32 tasks;
// Sharding config
3: optional Shards shards;
}
struct Shards {
// The internal representation for sharding (e.g. RawRegion.ASH), if in use for this service
1: optional sharding.RawRegion raw_region;
// The weight multiplier to apply for sharding (e.g. 2.5), if in use for this service
2: optional float replica_multiplier;
}

View File

@ -0,0 +1,32 @@
# @generated by autocargo from //configerator/structs/scm/mononoke/constants:constants-rust-mocks
[package]
name = "constants_mocks"
version = "0.1.0"
authors = ["Facebook"]
edition = "2021"
license = "GPLv2+"
build = "thrift_build.rs"
[lib]
path = "thrift_lib.rs"
test = false
doctest = false
doc = false
[dependencies]
anyhow = "1.0.75"
async-trait = "0.1.71"
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
const-cstr = "0.3.0"
constants__clients = { package = "constants_clients", version = "0.1.0", path = "../clients" }
constants__types = { package = "constants", version = "0.1.0", path = ".." }
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
futures = { version = "0.3.30", features = ["async-await", "compat"] }
sharding = { version = "0.1.0", path = "../../sharding" }
sharding_clients = { version = "0.1.0", path = "../../sharding/clients" }
sharding_mocks = { version = "0.1.0", path = "../../sharding/mocks" }
tracing = { version = "0.1.40", features = ["attributes", "valuable"] }
[build-dependencies]
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }

View File

@ -0,0 +1,26 @@
// @generated by autocargo
use std::env;
use std::fs;
use std::path::Path;
use thrift_compiler::Config;
use thrift_compiler::GenContext;
const CRATEMAP: &str = "\
configerator/structs/scm/mononoke/constants/constants.thrift crate //configerator/structs/scm/mononoke/constants:constants-rust
configerator/structs/scm/mononoke/sharding/sharding.thrift sharding //configerator/structs/scm/mononoke/sharding:sharding-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
Config::from_env(GenContext::Mocks)
.expect("Failed to instantiate thrift_compiler::Config")
.base_path("../../../../../..")
.types_crate("constants__types")
.clients_crate("constants__clients")
.options("serde")
.run(["../constants.thrift"])
.expect("Failed while running thrift compilation");
}

View File

@ -0,0 +1,3 @@
// @generated by autocargo
::codegen_includer_proc_macro::include!();

View File

@ -0,0 +1,30 @@
# @generated by autocargo from //configerator/structs/scm/mononoke/constants:constants-rust-services
[package]
name = "constants_services"
version = "0.1.0"
authors = ["Facebook"]
edition = "2021"
license = "GPLv2+"
build = "thrift_build.rs"
[lib]
path = "thrift_lib.rs"
test = false
doctest = false
doc = false
[dependencies]
anyhow = "1.0.75"
async-trait = "0.1.71"
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
const-cstr = "0.3.0"
constants__types = { package = "constants", version = "0.1.0", path = ".." }
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
futures = { version = "0.3.30", features = ["async-await", "compat"] }
sharding = { version = "0.1.0", path = "../../sharding" }
sharding_services = { version = "0.1.0", path = "../../sharding/services" }
tracing = { version = "0.1.40", features = ["attributes", "valuable"] }
[build-dependencies]
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }

View File

@ -0,0 +1,26 @@
// @generated by autocargo
use std::env;
use std::fs;
use std::path::Path;
use thrift_compiler::Config;
use thrift_compiler::GenContext;
const CRATEMAP: &str = "\
configerator/structs/scm/mononoke/constants/constants.thrift crate //configerator/structs/scm/mononoke/constants:constants-rust
configerator/structs/scm/mononoke/sharding/sharding.thrift sharding //configerator/structs/scm/mononoke/sharding:sharding-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
Config::from_env(GenContext::Services)
.expect("Failed to instantiate thrift_compiler::Config")
.base_path("../../../../../..")
.types_crate("constants__types")
.clients_crate("constants__clients")
.options("serde")
.run(["../constants.thrift"])
.expect("Failed while running thrift compilation");
}

View File

@ -0,0 +1,3 @@
// @generated by autocargo
::codegen_includer_proc_macro::include!();

View File

@ -0,0 +1,26 @@
// @generated by autocargo
use std::env;
use std::fs;
use std::path::Path;
use thrift_compiler::Config;
use thrift_compiler::GenContext;
const CRATEMAP: &str = "\
configerator/structs/scm/mononoke/constants/constants.thrift crate //configerator/structs/scm/mononoke/constants:constants-rust
configerator/structs/scm/mononoke/sharding/sharding.thrift sharding //configerator/structs/scm/mononoke/sharding:sharding-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
Config::from_env(GenContext::Types)
.expect("Failed to instantiate thrift_compiler::Config")
.base_path("../../../../..")
.types_crate("constants__types")
.clients_crate("constants__clients")
.options("serde")
.run(["constants.thrift"])
.expect("Failed while running thrift compilation");
}

View File

@ -0,0 +1,3 @@
// @generated by autocargo
::codegen_includer_proc_macro::include!();

View File

@ -0,0 +1,33 @@
# @generated by autocargo from //configerator/structs/scm/mononoke/sharding:sharding-rust
[package]
name = "sharding"
version = "0.1.0"
authors = ["Facebook"]
edition = "2021"
license = "GPLv2+"
build = "thrift_build.rs"
[lib]
path = "thrift_lib.rs"
test = false
doctest = false
doc = false
[dependencies]
anyhow = "1.0.75"
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
futures = { version = "0.3.30", features = ["async-await", "compat"] }
once_cell = "1.12"
ref-cast = "1.0.18"
serde = { version = "1.0.185", features = ["derive", "rc"] }
serde_derive = "1.0.185"
thiserror = "1.0.49"
[build-dependencies]
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
[features]
default = ["thrift_library_unittests_disabled"]
thrift_library_unittests_disabled = []

View File

@ -0,0 +1,15 @@
load("@fbcode_macros//build_defs:thrift_library.bzl", "thrift_library")
oncall("source_control")
thrift_library(
name = "sharding",
languages = [
"py",
"rust",
],
py_base_module = "configerator.mononoke",
thrift_py_options = "json",
thrift_rust_options = "serde",
thrift_srcs = {"sharding.thrift": None},
)

View File

@ -0,0 +1,28 @@
# @generated by autocargo from //configerator/structs/scm/mononoke/sharding:sharding-rust-clients
[package]
name = "sharding_clients"
version = "0.1.0"
authors = ["Facebook"]
edition = "2021"
license = "GPLv2+"
build = "thrift_build.rs"
[lib]
path = "thrift_lib.rs"
test = false
doctest = false
doc = false
[dependencies]
anyhow = "1.0.75"
async-trait = "0.1.71"
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
const-cstr = "0.3.0"
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
futures = { version = "0.3.30", features = ["async-await", "compat"] }
sharding__types = { package = "sharding", version = "0.1.0", path = ".." }
tracing = { version = "0.1.40", features = ["attributes", "valuable"] }
[build-dependencies]
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }

View File

@ -0,0 +1,25 @@
// @generated by autocargo
use std::env;
use std::fs;
use std::path::Path;
use thrift_compiler::Config;
use thrift_compiler::GenContext;
const CRATEMAP: &str = "\
configerator/structs/scm/mononoke/sharding/sharding.thrift crate //configerator/structs/scm/mononoke/sharding:sharding-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
Config::from_env(GenContext::Clients)
.expect("Failed to instantiate thrift_compiler::Config")
.base_path("../../../../../..")
.types_crate("sharding__types")
.clients_crate("sharding__clients")
.options("serde")
.run(["../sharding.thrift"])
.expect("Failed while running thrift compilation");
}

View File

@ -0,0 +1,3 @@
// @generated by autocargo
::codegen_includer_proc_macro::include!();

View File

@ -0,0 +1,29 @@
# @generated by autocargo from //configerator/structs/scm/mononoke/sharding:sharding-rust-mocks
[package]
name = "sharding_mocks"
version = "0.1.0"
authors = ["Facebook"]
edition = "2021"
license = "GPLv2+"
build = "thrift_build.rs"
[lib]
path = "thrift_lib.rs"
test = false
doctest = false
doc = false
[dependencies]
anyhow = "1.0.75"
async-trait = "0.1.71"
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
const-cstr = "0.3.0"
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
futures = { version = "0.3.30", features = ["async-await", "compat"] }
sharding__clients = { package = "sharding_clients", version = "0.1.0", path = "../clients" }
sharding__types = { package = "sharding", version = "0.1.0", path = ".." }
tracing = { version = "0.1.40", features = ["attributes", "valuable"] }
[build-dependencies]
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }

View File

@ -0,0 +1,25 @@
// @generated by autocargo
use std::env;
use std::fs;
use std::path::Path;
use thrift_compiler::Config;
use thrift_compiler::GenContext;
const CRATEMAP: &str = "\
configerator/structs/scm/mononoke/sharding/sharding.thrift crate //configerator/structs/scm/mononoke/sharding:sharding-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
Config::from_env(GenContext::Mocks)
.expect("Failed to instantiate thrift_compiler::Config")
.base_path("../../../../../..")
.types_crate("sharding__types")
.clients_crate("sharding__clients")
.options("serde")
.run(["../sharding.thrift"])
.expect("Failed while running thrift compilation");
}

View File

@ -0,0 +1,3 @@
// @generated by autocargo
::codegen_includer_proc_macro::include!();

View File

@ -0,0 +1,28 @@
# @generated by autocargo from //configerator/structs/scm/mononoke/sharding:sharding-rust-services
[package]
name = "sharding_services"
version = "0.1.0"
authors = ["Facebook"]
edition = "2021"
license = "GPLv2+"
build = "thrift_build.rs"
[lib]
path = "thrift_lib.rs"
test = false
doctest = false
doc = false
[dependencies]
anyhow = "1.0.75"
async-trait = "0.1.71"
codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
const-cstr = "0.3.0"
fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" }
futures = { version = "0.3.30", features = ["async-await", "compat"] }
sharding__types = { package = "sharding", version = "0.1.0", path = ".." }
tracing = { version = "0.1.40", features = ["attributes", "valuable"] }
[build-dependencies]
thrift_compiler = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }

View File

@ -0,0 +1,25 @@
// @generated by autocargo
use std::env;
use std::fs;
use std::path::Path;
use thrift_compiler::Config;
use thrift_compiler::GenContext;
const CRATEMAP: &str = "\
configerator/structs/scm/mononoke/sharding/sharding.thrift crate //configerator/structs/scm/mononoke/sharding:sharding-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
Config::from_env(GenContext::Services)
.expect("Failed to instantiate thrift_compiler::Config")
.base_path("../../../../../..")
.types_crate("sharding__types")
.clients_crate("sharding__clients")
.options("serde")
.run(["../sharding.thrift"])
.expect("Failed while running thrift compilation");
}

View File

@ -0,0 +1,3 @@
// @generated by autocargo
::codegen_includer_proc_macro::include!();

View File

@ -0,0 +1,159 @@
// @generated SignedSource<<41f710e2f47f7518d7b5660d608bbdf6>>
// DO NOT EDIT THIS FILE MANUALLY!
// This file is a mechanical copy of the version in the configerator repo. To
// modify it, edit the copy in the configerator repo instead and copy it over by
// running the following in your fbcode directory:
//
// configerator-thrift-updater scm/mononoke/sharding/sharding.thrift
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
namespace py configerator.mononoke.sharding
namespace py3 mononoke.sharding
namespace cpp2 mononoke.sharding
// NOTICE:
// Don't use 'defaults' for any of these values (e.g. 'bool enabled = true')
// because these structs will be deserialized by serde in rust. The following
// rules apply upon deserialization:
// 1) specified default values are ignored, default values will always be
// the 'Default::default()' value for a given type. For example, even
// if you specify:
// 1: bool enabled = true,
//
// upon decoding, if the field enabled isn't present, the default value
// will be false.
//
// 2) not specifying optional won't actually make your field required,
// neither will specifying required make any field required. Upon decoding
// with serde, all values will be Default::default() and no error will be
// given.
//
// 3) the only way to detect wether a field was specified in the structure
// being deserialized is by making a field optional. This will result in
// a 'None' value for a Option<T> in rust. So the way we can give default
// values other then 'Default::default()' is by making a field optional,
// and then explicitly handle 'None' after deserialization.
/// Struct representing the sharding configuration for a repo
/// independent of the type, job or region.
struct RawRepoShard {
// The number of replicas this repo-shard should have. e.g. If we need 10 instances of
// fbsource running for a job or request-serving process, then the replica count
// should be 10.
1: optional i64 replica_count;
// The weight of each replica of the repo-shard expressed as a fractional value. e.g. If
// a replica of aros repo-shard requires 15% of a hosts resources, then the repo-weight is
// expressed as 0.15. Based on the actual host capacity (say weight = 100,000), this is then
// converted to an integer value (100,000 * 0.15 = 15,000)
2: optional float weight;
// The list of shards that should NOT be co-located with the current repo-shard. e.g. If
// fbsource should not be co-located with www & configerator, then the conflicting_repo_shards
// should have the value ['www', 'configerator']
// NOTE: This feature is not currently supported by SM and will be supported in the future.
3: optional list<string> conflicting_repo_shards;
// The list of repo shards that are associated with the given shard. This property can be used
// for processes involving dual repo processing (e.g. fbsource to ovrsource backsyncer).
4: optional list<string> associated_repo_shards;
// The number of chunks to be created for the given repo shard. e.g. When chunks = 10 for repo
// fbsource, the shards would be created as: fbsource_CHUNK_1-10, fbsource_CHUNK_2-10 and so on.
// NOTE: If you want multiple tasks to run fbsource without any difference in state, then use
// replica_count to get miltiple replicas. If you want multiple tasks running fbsource but each
// to have a different state context (e.g. run X for the first 100K commit of fbsource), then
// use chunks.
5: optional i64 chunks;
// If chunking is enabled, this option controls the size of each chunk to be provided to the job/service.
// If the chunk size is dynamic and will be determined at runtime (e.g. AliasVerify), then this option
// should not be set. e.g. When chunks = 10, repo = fbsource and chunk_size = 10000 then the shards would
// be created as fbsource_CHUNK_1-10_SIZE_10000, fbsource_CHUNK_2-10_SIZE_10000
6: optional i64 chunk_size;
// If the repo needs to be chunked but the chunking strategy can be arbitrary then instead of
// just providing the total number of chunks, we can provide chunks + chunk_list. e.g. When
// chunks = 10 and chunk_list = [2, 3, 6] then the shards for repo fbsource would be created
// as fbsource_CHUNK_2-10, fbsource_CHUNK_3-10 and fbsource_CHUNK_6-10
7: optional list<i64> chunk_list;
} (rust.exhaustive)
/// The regions in which repo-shards can be deployed.
enum RawRegion {
UNKNOWN = 0,
GLOBAL = 1,
ATN = 2,
PRN = 3,
LLA = 4,
FTW = 5,
FRC = 6,
CLN = 7,
ASH = 9,
VLL = 10,
PNB = 11,
ODN = 12,
NAO = 13,
RVA = 14,
LDC = 15,
EAG = 16,
NCG = 17,
NHA = 18,
SNC = 19,
CCO = 20,
} (rust.exhaustive)
/// The names of the processes for which a repo can be executed in a sharded setting.
enum RawProcessName {
UNKNOWN = 0,
WALKER_SCRUB_ALL = 1,
WALKER_SCRUB_DERIVED = 2,
WALKER_SCRUB_HG_ALL = 3,
WALKER_SCRUB_UNODE_ALL = 4,
WALKER_SHALLOW_HG_SCRUB = 5,
WALKER_VALIDATE_ALL = 6,
HG_SYNC_BACKUP = 7,
HG_SYNC = 8,
DERIVED_DATA_TAILER = 9,
DERIVED_DATA_TAILER_BACKUP = 10,
X_REPO_BACKSYNCER = 11, // deprecated in favour of X_REPO_BACKSYNC
X_REPO_BOOKMARKS_VALIDATOR = 12,
EDEN_API = 13,
SCS = 14,
LFS = 15,
SHARDMANAGER_TEST = 16,
DERIVATION_WORKER = 17,
ALIAS_VERIFY = 18, // deprecated
ALIAS_VERIFY_BACKUP = 19, // deprecated
DRAFT_COMMIT_DELETION = 20,
STATISTICS_COLLECTOR = 21,
X_REPO_BACKSYNC = 22,
MONONOKE_GIT_SERVER = 23,
REPO_METADATA_LOGGER = 24,
} (rust.exhaustive)
/// Struct representing the sharding configuration for a repo
/// in the context of a specific job/process with defined region and type.
struct RawRepoProcessShard {
// Flag determining if the current RepoProcessShard is for background process
// like hg sync or for request serving process like SCS service.
1: optional bool is_background;
// Mapping of repo-shard configuration for each distinct region in which the
// shards can be deployed.
2: optional map<RawRegion, RawRepoShard> region_repo_shards;
} (rust.exhaustive)
/// Struct representing the overall sharding configuration for a repo.
struct RawRepoShardingConfig {
// Mapping of process names to the corresponding process shard configuration
// for the current repo.
1: optional map<RawProcessName, RawRepoProcessShard> process_shards;
} (rust.exhaustive)
/// Struct representing the mapping of repo-names to their corresponding
/// RawRepoShardingConfig.
struct RawShardingConfigs {
// Mapping of the repo-names to their corresponding RawRepoShardingConfig.
1: optional map<string, RawRepoShardingConfig> repo_sharding_configs;
// Mapping of the process names to the overall capacity for that process.
2: optional map<RawProcessName, i64> process_capacity;
} (rust.exhaustive)

View File

@ -0,0 +1,25 @@
// @generated by autocargo
use std::env;
use std::fs;
use std::path::Path;
use thrift_compiler::Config;
use thrift_compiler::GenContext;
const CRATEMAP: &str = "\
configerator/structs/scm/mononoke/sharding/sharding.thrift crate //configerator/structs/scm/mononoke/sharding:sharding-rust
";
#[rustfmt::skip]
fn main() {
println!("cargo:rerun-if-changed=thrift_build.rs");
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env not provided");
let cratemap_path = Path::new(&out_dir).join("cratemap");
fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap");
Config::from_env(GenContext::Types)
.expect("Failed to instantiate thrift_compiler::Config")
.base_path("../../../../..")
.types_crate("sharding__types")
.clients_crate("sharding__clients")
.options("serde")
.run(["sharding.thrift"])
.expect("Failed while running thrift compilation");
}

View File

@ -0,0 +1,3 @@
// @generated by autocargo
::codegen_includer_proc_macro::include!();