From 8ca4638313b166406116e94a10ba1285f888d3fb Mon Sep 17 00:00:00 2001 From: Ben Rogers Date: Tue, 8 Jul 2025 11:41:59 -0400 Subject: [PATCH 1/8] feat(oss): Update sapling/eden to use thrift LANGUAGES py3 --- build/fbcode_builder/manifests/boost | 1 + build/fbcode_builder/manifests/eden | 3 +++ build/fbcode_builder/manifests/fbthrift | 4 ++++ build/fbcode_builder/manifests/fmt | 1 + build/fbcode_builder/manifests/folly | 5 +++-- build/fbcode_builder/manifests/mvfst | 3 +++ eden/fs/config/CMakeLists.txt | 3 ++- eden/fs/inodes/overlay/overlay.thrift | 1 + eden/fs/py/CMakeLists.txt | 2 +- eden/fs/service/CMakeLists.txt | 3 ++- eden/integration/lib/CMakeLists.txt | 4 +++- 11 files changed, 24 insertions(+), 6 deletions(-) diff --git a/build/fbcode_builder/manifests/boost b/build/fbcode_builder/manifests/boost index eebbce5f4f1c1..1da8c545f48d1 100644 --- a/build/fbcode_builder/manifests/boost +++ b/build/fbcode_builder/manifests/boost @@ -68,6 +68,7 @@ job_weight_mib = 512 patchfile = boost_comparator_operator_fix.patch [b2.args] +link=static,shared --with-atomic --with-chrono --with-container diff --git a/build/fbcode_builder/manifests/eden b/build/fbcode_builder/manifests/eden index d7bc911612e39..9304accf99062 100644 --- a/build/fbcode_builder/manifests/eden +++ b/build/fbcode_builder/manifests/eden @@ -100,6 +100,9 @@ fbcode/configerator/structs/scm/hg/public_autocargo = configerator/structs/scm/h ^.*/facebook/.*$ ^.*/fb/.*$ +[cmake.defines] +PYTHON_EXTENSIONS=ON + [cmake.defines.all(fb=on,os=windows)] ENABLE_GIT=OFF INSTALL_PYTHON_LIB=ON diff --git a/build/fbcode_builder/manifests/fbthrift b/build/fbcode_builder/manifests/fbthrift index c3b8e0d0729b8..47ff264fb2627 100644 --- a/build/fbcode_builder/manifests/fbthrift +++ b/build/fbcode_builder/manifests/fbthrift @@ -40,3 +40,7 @@ xplat/thrift = thrift ^xplat/thrift/perf/canary.py$ ^xplat/thrift/perf/loadtest.py$ ^xplat/thrift/.castle/.* + +[cmake.defines] +thriftpy3=ON +BUILD_SHARED_LIBS=ON diff --git a/build/fbcode_builder/manifests/fmt b/build/fbcode_builder/manifests/fmt index e7faa7a56c81f..e63d05e5adfca 100644 --- a/build/fbcode_builder/manifests/fmt +++ b/build/fbcode_builder/manifests/fmt @@ -10,6 +10,7 @@ builder = cmake subdir = fmt-11.0.2 [cmake.defines] +BUILD_SHARED_LIBS = ON FMT_TEST = OFF FMT_DOC = OFF diff --git a/build/fbcode_builder/manifests/folly b/build/fbcode_builder/manifests/folly index e8bc7d4828c19..7c7a20321f1f5 100644 --- a/build/fbcode_builder/manifests/folly +++ b/build/fbcode_builder/manifests/folly @@ -62,8 +62,9 @@ fbcode/folly = folly ^fbcode/folly/public_tld/build/facebook_.* [cmake.defines] -BUILD_SHARED_LIBS=OFF -BOOST_LINK_STATIC=ON +PYTHON_EXTENSIONS=ON +BUILD_SHARED_LIBS=ON +BOOST_LINK_STATIC=OFF [cmake.defines.os=freebsd] LIBDWARF_FOUND=NO diff --git a/build/fbcode_builder/manifests/mvfst b/build/fbcode_builder/manifests/mvfst index c2a797be23478..a38bc02e89c1d 100644 --- a/build/fbcode_builder/manifests/mvfst +++ b/build/fbcode_builder/manifests/mvfst @@ -11,6 +11,9 @@ repo_url = https://github.com/facebook/mvfst.git builder = cmake subdir = . +[cmake.defines] +BUILD_SHARED_LIBS = ON + [cmake.defines.test=on] BUILD_TESTS = ON diff --git a/eden/fs/config/CMakeLists.txt b/eden/fs/config/CMakeLists.txt index 3cf2bcae50405..80e2198f6c593 100644 --- a/eden/fs/config/CMakeLists.txt +++ b/eden/fs/config/CMakeLists.txt @@ -6,8 +6,9 @@ add_fbthrift_library( eden_config_thrift eden_config.thrift - LANGUAGES cpp py + LANGUAGES cpp py py3 PY_NAMESPACE facebook.eden.eden_config + PY3_NAMESPACE eden.fs.config.eden_config ) file(GLOB CONFIG_SRCS "*.cpp") diff --git a/eden/fs/inodes/overlay/overlay.thrift b/eden/fs/inodes/overlay/overlay.thrift index 4681024b05cc9..34922b1ca1520 100644 --- a/eden/fs/inodes/overlay/overlay.thrift +++ b/eden/fs/inodes/overlay/overlay.thrift @@ -8,6 +8,7 @@ namespace py3 facebook.eden namespace cpp2 facebook.eden.overlay namespace py facebook.eden.overlay +namespace py3 eden.fs.overlay typedef binary Hash typedef string PathComponent diff --git a/eden/fs/py/CMakeLists.txt b/eden/fs/py/CMakeLists.txt index 7b9a1c45af98a..1f9c8dac2f3a3 100644 --- a/eden/fs/py/CMakeLists.txt +++ b/eden/fs/py/CMakeLists.txt @@ -11,5 +11,5 @@ add_fb_python_library( ${EDEN_PY_SRCS} # Also include the generated eden/config.py file "${CMAKE_CURRENT_BINARY_DIR}/eden/config.py=eden/config.py" - DEPENDS eden_service_thrift_py + DEPENDS eden_service_thrift_py3 ) diff --git a/eden/fs/service/CMakeLists.txt b/eden/fs/service/CMakeLists.txt index 7f41ea2305370..18b9a90d31b21 100644 --- a/eden/fs/service/CMakeLists.txt +++ b/eden/fs/service/CMakeLists.txt @@ -6,8 +6,9 @@ add_fbthrift_library( eden_service_thrift eden.thrift - LANGUAGES cpp py + LANGUAGES cpp py py3 rust PY_NAMESPACE facebook.eden + PY3_NAMESPACE eden.fs.service.eden SERVICES EdenService DEPENDS diff --git a/eden/integration/lib/CMakeLists.txt b/eden/integration/lib/CMakeLists.txt index b6b964a191548..01fea86be6f2d 100644 --- a/eden/integration/lib/CMakeLists.txt +++ b/eden/integration/lib/CMakeLists.txt @@ -19,8 +19,10 @@ add_fb_python_library( SOURCES ${INTEGRATION_LIB_SRCS} DEPENDS edenfsctl.real.main_lib + eden_config_thrift_py3 + eden_service_thrift_py3 eden_py - eden_service_thrift_py eden_test_support + fb303::fb303_core_py3 ${INTEGRATION_LIB_DEPENDENCIES} ) From 6284823cbed8e002001ca5203d762c29fc77552c Mon Sep 17 00:00:00 2001 From: Ben Rogers Date: Tue, 8 Jul 2025 11:41:59 -0400 Subject: [PATCH 2/8] feat(oss): Move "thrift" rust wrapper parallel to "thrift_streaming" --- eden/fs/service/{ => thrift}/Cargo.toml | 2 +- eden/fs/service/{ => thrift}/thrift_build.rs | 4 ++-- eden/fs/service/{ => thrift}/thrift_lib.rs | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename eden/fs/service/{ => thrift}/Cargo.toml (96%) rename eden/fs/service/{ => thrift}/thrift_build.rs (94%) rename eden/fs/service/{ => thrift}/thrift_lib.rs (100%) diff --git a/eden/fs/service/Cargo.toml b/eden/fs/service/thrift/Cargo.toml similarity index 96% rename from eden/fs/service/Cargo.toml rename to eden/fs/service/thrift/Cargo.toml index 75fcf51c08cff..1b7458fbdf50b 100644 --- a/eden/fs/service/Cargo.toml +++ b/eden/fs/service/thrift/Cargo.toml @@ -17,7 +17,7 @@ doc = false [dependencies] anyhow = "1.0.98" codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" } -config_thrift = { version = "0.1.0", path = "../config" } +config_thrift = { version = "0.1.0", path = "../../config" } cpp = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } fb303_core = { version = "0.0.0", git = "https://github.com/facebook/fb303.git", branch = "main" } fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } diff --git a/eden/fs/service/thrift_build.rs b/eden/fs/service/thrift/thrift_build.rs similarity index 94% rename from eden/fs/service/thrift_build.rs rename to eden/fs/service/thrift/thrift_build.rs index 9b96f1329f821..59eb9918072f4 100644 --- a/eden/fs/service/thrift_build.rs +++ b/eden/fs/service/thrift/thrift_build.rs @@ -22,10 +22,10 @@ fn main() { fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap"); Config::from_env(GenContext::Types) .expect("Failed to instantiate thrift_compiler::Config") - .base_path("../../..") + .base_path("../../../..") .types_crate("thrift__types") .clients_crate("thrift__clients") .options("deprecated_default_enum_min_i32") - .run(["eden.thrift"]) + .run(["../eden.thrift"]) .expect("Failed while running thrift compilation"); } diff --git a/eden/fs/service/thrift_lib.rs b/eden/fs/service/thrift/thrift_lib.rs similarity index 100% rename from eden/fs/service/thrift_lib.rs rename to eden/fs/service/thrift/thrift_lib.rs From 8d571591e314ee8a07bea2992fa34e7cf5f60dac Mon Sep 17 00:00:00 2001 From: Ben Rogers Date: Tue, 8 Jul 2025 11:41:59 -0400 Subject: [PATCH 3/8] feat(oss): Move thrift mocks into new location --- eden/fs/service/{ => thrift}/mocks/Cargo.toml | 6 +++--- eden/fs/service/{ => thrift}/mocks/thrift_build.rs | 4 ++-- eden/fs/service/{ => thrift}/mocks/thrift_lib.rs | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename eden/fs/service/{ => thrift}/mocks/Cargo.toml (91%) rename eden/fs/service/{ => thrift}/mocks/thrift_build.rs (94%) rename eden/fs/service/{ => thrift}/mocks/thrift_lib.rs (100%) diff --git a/eden/fs/service/mocks/Cargo.toml b/eden/fs/service/thrift/mocks/Cargo.toml similarity index 91% rename from eden/fs/service/mocks/Cargo.toml rename to eden/fs/service/thrift/mocks/Cargo.toml index 1f0958302a041..1751db9a71e8f 100644 --- a/eden/fs/service/mocks/Cargo.toml +++ b/eden/fs/service/thrift/mocks/Cargo.toml @@ -18,9 +18,9 @@ doc = false anyhow = "1.0.98" async-trait = "0.1.86" codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" } -config_thrift = { version = "0.1.0", path = "../../config" } -config_thrift_clients = { version = "0.1.0", path = "../../config/clients" } -config_thrift_mocks = { version = "0.1.0", path = "../../config/mocks" } +config_thrift = { version = "0.1.0", path = "../../../config" } +config_thrift_clients = { version = "0.1.0", path = "../../../config/clients" } +config_thrift_mocks = { version = "0.1.0", path = "../../../config/mocks" } cpp = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } cpp_clients = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } cpp_mocks = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } diff --git a/eden/fs/service/mocks/thrift_build.rs b/eden/fs/service/thrift/mocks/thrift_build.rs similarity index 94% rename from eden/fs/service/mocks/thrift_build.rs rename to eden/fs/service/thrift/mocks/thrift_build.rs index 3b725bb8e0fd6..861d24a9b1acc 100644 --- a/eden/fs/service/mocks/thrift_build.rs +++ b/eden/fs/service/thrift/mocks/thrift_build.rs @@ -22,10 +22,10 @@ fn main() { fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap"); Config::from_env(GenContext::Mocks) .expect("Failed to instantiate thrift_compiler::Config") - .base_path("../../../..") + .base_path("../../../../..") .types_crate("thrift__types") .clients_crate("thrift__clients") .options("deprecated_default_enum_min_i32") - .run(["../eden.thrift"]) + .run(["../../eden.thrift"]) .expect("Failed while running thrift compilation"); } diff --git a/eden/fs/service/mocks/thrift_lib.rs b/eden/fs/service/thrift/mocks/thrift_lib.rs similarity index 100% rename from eden/fs/service/mocks/thrift_lib.rs rename to eden/fs/service/thrift/mocks/thrift_lib.rs From fbab44368f6b2534d0578e64d2eed9228eb9ed0b Mon Sep 17 00:00:00 2001 From: Ben Rogers Date: Tue, 8 Jul 2025 11:41:59 -0400 Subject: [PATCH 4/8] feat(oss): Move thrift clients into new location --- eden/fs/service/{ => thrift}/clients/Cargo.toml | 4 ++-- eden/fs/service/{ => thrift}/clients/thrift_build.rs | 4 ++-- eden/fs/service/{ => thrift}/clients/thrift_lib.rs | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename eden/fs/service/{ => thrift}/clients/Cargo.toml (92%) rename eden/fs/service/{ => thrift}/clients/thrift_build.rs (94%) rename eden/fs/service/{ => thrift}/clients/thrift_lib.rs (100%) diff --git a/eden/fs/service/clients/Cargo.toml b/eden/fs/service/thrift/clients/Cargo.toml similarity index 92% rename from eden/fs/service/clients/Cargo.toml rename to eden/fs/service/thrift/clients/Cargo.toml index 9709396aaf1da..b41dad99ba854 100644 --- a/eden/fs/service/clients/Cargo.toml +++ b/eden/fs/service/thrift/clients/Cargo.toml @@ -18,8 +18,8 @@ doc = false anyhow = "1.0.98" async-trait = "0.1.86" codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" } -config_thrift = { version = "0.1.0", path = "../../config" } -config_thrift_clients = { version = "0.1.0", path = "../../config/clients" } +config_thrift = { version = "0.1.0", path = "../../../config" } +config_thrift_clients = { version = "0.1.0", path = "../../../config/clients" } cpp = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } cpp_clients = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } fb303_core = { version = "0.0.0", git = "https://github.com/facebook/fb303.git", branch = "main" } diff --git a/eden/fs/service/clients/thrift_build.rs b/eden/fs/service/thrift/clients/thrift_build.rs similarity index 94% rename from eden/fs/service/clients/thrift_build.rs rename to eden/fs/service/thrift/clients/thrift_build.rs index 204435cb5dba0..0caaa7cba8c8f 100644 --- a/eden/fs/service/clients/thrift_build.rs +++ b/eden/fs/service/thrift/clients/thrift_build.rs @@ -22,10 +22,10 @@ fn main() { fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap"); Config::from_env(GenContext::Clients) .expect("Failed to instantiate thrift_compiler::Config") - .base_path("../../../..") + .base_path("../../../../..") .types_crate("thrift__types") .clients_crate("thrift__clients") .options("deprecated_default_enum_min_i32") - .run(["../eden.thrift"]) + .run(["../../eden.thrift"]) .expect("Failed while running thrift compilation"); } diff --git a/eden/fs/service/clients/thrift_lib.rs b/eden/fs/service/thrift/clients/thrift_lib.rs similarity index 100% rename from eden/fs/service/clients/thrift_lib.rs rename to eden/fs/service/thrift/clients/thrift_lib.rs From 24cff4603818fe6cff29f5da3b94dcb122a31991 Mon Sep 17 00:00:00 2001 From: Ben Rogers Date: Tue, 8 Jul 2025 11:41:59 -0400 Subject: [PATCH 5/8] feat(oss): Move thrift services into new location --- eden/fs/service/{ => thrift}/services/Cargo.toml | 4 ++-- eden/fs/service/{ => thrift}/services/thrift_build.rs | 4 ++-- eden/fs/service/{ => thrift}/services/thrift_lib.rs | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename eden/fs/service/{ => thrift}/services/Cargo.toml (92%) rename eden/fs/service/{ => thrift}/services/thrift_build.rs (94%) rename eden/fs/service/{ => thrift}/services/thrift_lib.rs (100%) diff --git a/eden/fs/service/services/Cargo.toml b/eden/fs/service/thrift/services/Cargo.toml similarity index 92% rename from eden/fs/service/services/Cargo.toml rename to eden/fs/service/thrift/services/Cargo.toml index aae86f22bdc8f..46f27da349188 100644 --- a/eden/fs/service/services/Cargo.toml +++ b/eden/fs/service/thrift/services/Cargo.toml @@ -18,8 +18,8 @@ doc = false anyhow = "1.0.98" async-trait = "0.1.86" codegen_includer_proc_macro = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" } -config_thrift = { version = "0.1.0", path = "../../config" } -config_thrift_services = { version = "0.1.0", path = "../../config/services" } +config_thrift = { version = "0.1.0", path = "../../../config" } +config_thrift_services = { version = "0.1.0", path = "../../../config/services" } cpp = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } cpp_services = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } fb303_core = { version = "0.0.0", git = "https://github.com/facebook/fb303.git", branch = "main" } diff --git a/eden/fs/service/services/thrift_build.rs b/eden/fs/service/thrift/services/thrift_build.rs similarity index 94% rename from eden/fs/service/services/thrift_build.rs rename to eden/fs/service/thrift/services/thrift_build.rs index 7ea8ab0bb80af..5604f44fd86f3 100644 --- a/eden/fs/service/services/thrift_build.rs +++ b/eden/fs/service/thrift/services/thrift_build.rs @@ -22,10 +22,10 @@ fn main() { fs::write(cratemap_path, CRATEMAP).expect("Failed to write cratemap"); Config::from_env(GenContext::Services) .expect("Failed to instantiate thrift_compiler::Config") - .base_path("../../../..") + .base_path("../../../../..") .types_crate("thrift__types") .clients_crate("thrift__clients") .options("deprecated_default_enum_min_i32") - .run(["../eden.thrift"]) + .run(["../../eden.thrift"]) .expect("Failed while running thrift compilation"); } diff --git a/eden/fs/service/services/thrift_lib.rs b/eden/fs/service/thrift/services/thrift_lib.rs similarity index 100% rename from eden/fs/service/services/thrift_lib.rs rename to eden/fs/service/thrift/services/thrift_lib.rs From e44b7c7e9cb6286dec3612abd32f2fbb32298a8c Mon Sep 17 00:00:00 2001 From: Ben Rogers Date: Tue, 8 Jul 2025 11:41:59 -0400 Subject: [PATCH 6/8] feat(oss): point Rust code to new thrift locations --- eden/fs/Cargo.toml | 8 ++++---- eden/fs/cli_rs/edenfs-error/Cargo.toml | 4 +++- eden/fs/service/thrift_streaming/Cargo.toml | 2 +- eden/fs/service/thrift_streaming/clients/Cargo.toml | 5 ++--- eden/fs/service/thrift_streaming/mocks/Cargo.toml | 6 +++--- eden/fs/service/thrift_streaming/services/Cargo.toml | 4 ++-- eden/scm/lib/thrift-types/Cargo.toml | 4 ++-- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/eden/fs/Cargo.toml b/eden/fs/Cargo.toml index efcd8caff0aba..2e7b62f6fef55 100644 --- a/eden/fs/Cargo.toml +++ b/eden/fs/Cargo.toml @@ -65,10 +65,10 @@ members = [ "rust/edenfs-asserted-states", "rust/edenfs-asserted-states-client", "rust/redirect_ffi", - "service", - "service/clients", - "service/mocks", - "service/services", + "service/thrift", + "service/thrift/clients", + "service/thrift/mocks", + "service/thrift/services", "service/thrift_streaming", "service/thrift_streaming/clients", "service/thrift_streaming/mocks", diff --git a/eden/fs/cli_rs/edenfs-error/Cargo.toml b/eden/fs/cli_rs/edenfs-error/Cargo.toml index 735ec8d8b8ea9..c887a5786debb 100644 --- a/eden/fs/cli_rs/edenfs-error/Cargo.toml +++ b/eden/fs/cli_rs/edenfs-error/Cargo.toml @@ -9,7 +9,9 @@ license = "GPLv2+" [dependencies] anyhow = "1.0.98" -sapling-thrift-types = { version = "0.1.0", path = "../../../scm/lib/thrift-types" } +thrift = { version = "0.1.0", path = "../../service/thrift" } thiserror = "2.0.12" +thrift_clients = { version = "0.1.0", path = "../../service/thrift/clients" } +thrift_streaming__types = { package = "thrift_streaming", version = "0.1.0", path = "../../service/thrift_streaming" } thrift_streaming_clients = { version = "0.1.0", path = "../../service/thrift_streaming/clients" } tokio = { version = "1.47.1", features = ["full", "test-util", "tracing"] } diff --git a/eden/fs/service/thrift_streaming/Cargo.toml b/eden/fs/service/thrift_streaming/Cargo.toml index 2a55807fb5c84..052a5ab987035 100644 --- a/eden/fs/service/thrift_streaming/Cargo.toml +++ b/eden/fs/service/thrift_streaming/Cargo.toml @@ -21,7 +21,7 @@ fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbth futures = { version = "0.3.31", features = ["async-await", "compat"] } ref-cast = "1.0.18" thiserror = "2.0.12" -thrift__0 = { package = "thrift", version = "0.1.0", path = ".." } +thrift__0 = { package = "thrift", version = "0.1.0", path = "../thrift" } thrift__1 = { package = "thrift", version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } [build-dependencies] diff --git a/eden/fs/service/thrift_streaming/clients/Cargo.toml b/eden/fs/service/thrift_streaming/clients/Cargo.toml index 4b13c56e6001d..313c309816235 100644 --- a/eden/fs/service/thrift_streaming/clients/Cargo.toml +++ b/eden/fs/service/thrift_streaming/clients/Cargo.toml @@ -20,9 +20,8 @@ async-trait = "0.1.86" 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.31", features = ["async-await", "compat"] } -thrift__0 = { package = "thrift", version = "0.1.0", path = "../.." } -thrift__0_clients = { package = "thrift_clients", version = "0.1.0", path = "../../clients" } -thrift__1 = { package = "thrift", version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } +thrift__0 = { package = "thrift", version = "0.1.0", path = "../../thrift" } +thrift__0_clients = { package = "thrift_clients", version = "0.1.0", path = "../../thrift/clients" } thrift__1_clients = { package = "thrift_clients", version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } thrift_streaming__types = { package = "thrift_streaming", version = "0.1.0", path = ".." } tracing = { version = "0.1.41", features = ["attributes", "valuable"] } diff --git a/eden/fs/service/thrift_streaming/mocks/Cargo.toml b/eden/fs/service/thrift_streaming/mocks/Cargo.toml index 42c1a41442ef8..fea1d7678bd53 100644 --- a/eden/fs/service/thrift_streaming/mocks/Cargo.toml +++ b/eden/fs/service/thrift_streaming/mocks/Cargo.toml @@ -20,9 +20,9 @@ async-trait = "0.1.86" 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.31", features = ["async-await", "compat"] } -thrift__0 = { package = "thrift", version = "0.1.0", path = "../.." } -thrift__0_clients = { package = "thrift_clients", version = "0.1.0", path = "../../clients" } -thrift__0_mocks = { package = "thrift_mocks", version = "0.1.0", path = "../../mocks" } +thrift__0 = { package = "thrift", version = "0.1.0", path = "../../thrift" } +thrift__0_clients = { package = "thrift_clients", version = "0.1.0", path = "../../thrift/clients" } +thrift__0_mocks = { package = "thrift_mocks", version = "0.1.0", path = "../../thrift/mocks" } thrift__1 = { package = "thrift", version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } thrift__1_clients = { package = "thrift_clients", version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } thrift__1_mocks = { package = "thrift_mocks", version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } diff --git a/eden/fs/service/thrift_streaming/services/Cargo.toml b/eden/fs/service/thrift_streaming/services/Cargo.toml index 8cac07c6eddef..ec2883b17b40f 100644 --- a/eden/fs/service/thrift_streaming/services/Cargo.toml +++ b/eden/fs/service/thrift_streaming/services/Cargo.toml @@ -20,8 +20,8 @@ async-trait = "0.1.86" 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.31", features = ["async-await", "compat"] } -thrift__0 = { package = "thrift", version = "0.1.0", path = "../.." } -thrift__0_services = { package = "thrift_services", version = "0.1.0", path = "../../services" } +thrift__0 = { package = "thrift", version = "0.1.0", path = "../../thrift" } +thrift__0_services = { package = "thrift_services", version = "0.1.0", path = "../../thrift/services" } thrift__1 = { package = "thrift", version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } thrift__1_services = { package = "thrift_services", version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } thrift_streaming__types = { package = "thrift_streaming", version = "0.1.0", path = ".." } diff --git a/eden/scm/lib/thrift-types/Cargo.toml b/eden/scm/lib/thrift-types/Cargo.toml index 887b39dc48ec7..0fe51ab6057e7 100644 --- a/eden/scm/lib/thrift-types/Cargo.toml +++ b/eden/scm/lib/thrift-types/Cargo.toml @@ -14,8 +14,8 @@ name = "thrift_types" [dependencies] anyhow = "1.0.98" -edenfs = { package = "thrift", version = "0.1.0", path = "../../../fs/service" } -edenfs_clients = { package = "thrift_clients", version = "0.1.0", path = "../../../fs/service/clients" } +edenfs = { package = "thrift", version = "0.1.0", path = "../../../fs/service/thrift" } +edenfs_clients = { package = "thrift_clients", version = "0.1.0", path = "../../../fs/service/thrift/clients" } edenfs_config = { package = "config_thrift", version = "0.1.0", path = "../../../fs/config" } fb303_core = { version = "0.0.0", git = "https://github.com/facebook/fb303.git", branch = "main" } fbthrift = { version = "0.0.1+unstable", git = "https://github.com/facebook/fbthrift.git", branch = "main" } From da1d6c72e74d35100f769cb13b02bc2e7dc4d92c Mon Sep 17 00:00:00 2001 From: Ben Rogers Date: Tue, 8 Jul 2025 11:41:59 -0400 Subject: [PATCH 7/8] feat(oss): Introduce OSS wrapper crates for thrift/thrift_streaming --- eden/fs/Cargo.toml | 1 + eden/fs/cli_rs/edenfs-client/Cargo.toml | 2 + .../oss-streaming-thriftclients/Cargo.toml | 21 +++++++++ .../oss-streaming-thriftclients/lib.rs | 43 +++++++++++++++++++ eden/fs/service/oss-thriftclients/Cargo.toml | 13 ++++++ eden/fs/service/oss-thriftclients/lib.rs | 13 ++++++ 6 files changed, 93 insertions(+) create mode 100644 eden/fs/service/oss-streaming-thriftclients/Cargo.toml create mode 100644 eden/fs/service/oss-streaming-thriftclients/lib.rs create mode 100644 eden/fs/service/oss-thriftclients/Cargo.toml create mode 100644 eden/fs/service/oss-thriftclients/lib.rs diff --git a/eden/fs/Cargo.toml b/eden/fs/Cargo.toml index 2e7b62f6fef55..a487268989795 100644 --- a/eden/fs/Cargo.toml +++ b/eden/fs/Cargo.toml @@ -65,6 +65,7 @@ members = [ "rust/edenfs-asserted-states", "rust/edenfs-asserted-states-client", "rust/redirect_ffi", + "service/oss-thriftclients", "service/thrift", "service/thrift/clients", "service/thrift/mocks", diff --git a/eden/fs/cli_rs/edenfs-client/Cargo.toml b/eden/fs/cli_rs/edenfs-client/Cargo.toml index eec86be9ada0d..83b7c2b605c6b 100644 --- a/eden/fs/cli_rs/edenfs-client/Cargo.toml +++ b/eden/fs/cli_rs/edenfs-client/Cargo.toml @@ -38,7 +38,9 @@ shlex = "1.3" strum = { version = "0.27.1", features = ["derive"] } subprocess = "0.2.9" sysinfo = "0.35.1" +thrift_thriftclients = { version = "0.1.0", path = "../../service/oss-thriftclients" } thrift_streaming_clients = { version = "0.1.0", path = "../../service/thrift_streaming/clients" } +thrift_streaming_thriftclients = { version = "0.1.0", path = "../../service/oss-streaming-thriftclients" } tokio = { version = "1.47.1", features = ["full", "test-util", "tracing"] } toml = { version = "0.9.2", features = ["preserve_order"] } tracing = { version = "0.1.41", features = ["attributes", "valuable"] } diff --git a/eden/fs/service/oss-streaming-thriftclients/Cargo.toml b/eden/fs/service/oss-streaming-thriftclients/Cargo.toml new file mode 100644 index 0000000000000..314e0c2d5a6c1 --- /dev/null +++ b/eden/fs/service/oss-streaming-thriftclients/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "thrift_streaming_thriftclients" +version = "0.1.0" +authors = ["Facebook Source Control Team "] +edition = "2024" + +[dependencies] +anyhow = "1.0.98" +edenfs-error = { version = "0.1.0", path = "../../cli_rs/edenfs-error" } +fbinit = { version = "0.2.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" } +fbthrift_socket = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" } +syn = { version = "1.0.109" } +thrift_streaming_clients = { version = "0.1.0", path = "../thrift_streaming/clients" } +tokio = { version = "1.45.0", features = ["full", "test-util", "tracing"] } + +[lib] +path = "lib.rs" +test = false +doctest = false +doc = false diff --git a/eden/fs/service/oss-streaming-thriftclients/lib.rs b/eden/fs/service/oss-streaming-thriftclients/lib.rs new file mode 100644 index 0000000000000..1eb413b909c62 --- /dev/null +++ b/eden/fs/service/oss-streaming-thriftclients/lib.rs @@ -0,0 +1,43 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This software may be used and distributed according to the terms of the + * GNU General Public License version 2. + */ + +extern crate fbinit; +extern crate fbthrift; +extern crate proc_macro; +extern crate syn; +extern crate thrift_streaming_clients; + +use fbthrift::thrift_protocol::ProtocolID; +use std::net::SocketAddr; +use std::path::PathBuf; +use syn::{ + parse::{Parse, ParseStream}, + parse_macro_input, +}; + +pub use fbthrift_socket::SocketTransport; +pub use fbthrift::CompactProtocol; +use std::sync::Arc; +pub use thrift_streaming_clients::StreamingEdenServiceExt; +pub use thrift_streaming_clients::StreamingEdenServiceImpl; +pub use edenfs_error::ConnectError; + +#[macro_export] +macro_rules! make_StreamingEdenServiceExt_thriftclient { + + ($fbinit:expr, $($key:ident = $value:expr),* $(,)?) => { + Result::<_, anyhow::Error>::Ok( + Arc::new(<$crate::StreamingEdenServiceImpl<$crate::CompactProtocol, $crate::SocketTransport>>::new( + $crate::SocketTransport::new( + tokio::net::UnixStream::connect("foo") + .await + .map_err(|e| ConnectError::ConnectionError(e.to_string()))? + ) + )) + ) + }; +} diff --git a/eden/fs/service/oss-thriftclients/Cargo.toml b/eden/fs/service/oss-thriftclients/Cargo.toml new file mode 100644 index 0000000000000..289e57ad3af7d --- /dev/null +++ b/eden/fs/service/oss-thriftclients/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "thrift_thriftclients" # this crate’s name +version = "0.1.0" + +[dependencies] +# thrift_clients = { version = "0.1.0", path = "../clients" } +thrift__types = { package = "thrift_clients", version = "0.1.0", path = "../thrift/clients" } + +[lib] +path = "lib.rs" +test = false +doctest = false +doc = false diff --git a/eden/fs/service/oss-thriftclients/lib.rs b/eden/fs/service/oss-thriftclients/lib.rs new file mode 100644 index 0000000000000..6464bbaab5938 --- /dev/null +++ b/eden/fs/service/oss-thriftclients/lib.rs @@ -0,0 +1,13 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This software may be used and distributed according to the terms of the + * GNU General Public License version 2. + */ + +extern crate thrift__types; + +pub mod thrift { + pub use ::thrift__types::errors; + +} From dfa4803bb25bf24563176020f7966ca8c58fbc7d Mon Sep 17 00:00:00 2001 From: Ben Rogers Date: Tue, 9 Sep 2025 09:21:07 -0400 Subject: [PATCH 8/8] fix(oss): fix thrift build/path issues --- eden/fs/cli_rs/edenfs-error/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eden/fs/cli_rs/edenfs-error/Cargo.toml b/eden/fs/cli_rs/edenfs-error/Cargo.toml index c887a5786debb..0228e99dd21e2 100644 --- a/eden/fs/cli_rs/edenfs-error/Cargo.toml +++ b/eden/fs/cli_rs/edenfs-error/Cargo.toml @@ -9,9 +9,11 @@ license = "GPLv2+" [dependencies] anyhow = "1.0.98" +sapling-thrift-types = { version = "0.1.0", path = "../../../scm/lib/thrift-types" } thrift = { version = "0.1.0", path = "../../service/thrift" } thiserror = "2.0.12" thrift_clients = { version = "0.1.0", path = "../../service/thrift/clients" } thrift_streaming__types = { package = "thrift_streaming", version = "0.1.0", path = "../../service/thrift_streaming" } thrift_streaming_clients = { version = "0.1.0", path = "../../service/thrift_streaming/clients" } +thrift_thriftclients = { version = "0.1.0", path = "../../service/oss-thriftclients" } tokio = { version = "1.47.1", features = ["full", "test-util", "tracing"] }