Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Sapling",
"build": {
"context": "..",
"dockerfile": "../.github/workflows/sapling-cli-ubuntu-22.04.Dockerfile"
"dockerfile": "../.github/workflows/manylinux_2_34.Dockerfile"
},
"updateContentCommand": "ln -sf /workspaces/sapling/eden/scm/sl /usr/local/bin/sl",
"customizations": {
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ else()
endif()

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "setting C++ standard to C++${CMAKE_CXX_STANDARD}")
endif()
Expand Down
40 changes: 40 additions & 0 deletions common/network/Hostname.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/

#pragma once

namespace facebook {
namespace network {

constexpr std::string_view DOMAIN_SUFFIX = ".facebook.com";

inline std::string getLocalHost(bool stripFbDomain) {
std::array<char, HOST_NAME_MAX + 1> buf{};

if (::gethostname(buf.data(), buf.size()) != 0) {
throw std::system_error(errno, std::generic_category(), "gethostname failed");
}

std::string hostname(buf.data());

if (stripFbDomain &&
hostname.size() >= DOMAIN_SUFFIX.size() &&
hostname.compare(hostname.size() - DOMAIN_SUFFIX.size(),
DOMAIN_SUFFIX.size(),
DOMAIN_SUFFIX) == 0)
{
hostname.resize(hostname.size() - DOMAIN_SUFFIX.size());
}

return hostname;
}

} // namespace network
} // namespace facebook
1 change: 1 addition & 0 deletions eden/fs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ add_subdirectory(notifications)
add_subdirectory(prjfs)
add_subdirectory(py)
add_subdirectory(rocksdb)
add_subdirectory(rust/redirect_ffi)
add_subdirectory(service)
add_subdirectory(sqlite)
add_subdirectory(store)
Expand Down
3 changes: 0 additions & 3 deletions eden/fs/cli_rs/edenfs-client/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ oncall("scm_client_infra")
rust_library(
name = "edenfs-client",
srcs = glob(["src/**/*.rs"]),
named_deps = {
"hg_util": "//eden/scm/lib/util:util",
},
os_deps = [
(
"windows",
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/cli_rs/edenfs-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ fbinit = { version = "0.2.0", git = "https://github.com/facebookexperimental/rus
futures = { version = "0.3.31", features = ["async-await", "compat"] }
futures_stats = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
hex = { version = "0.4.3", features = ["alloc"] }
hg_util = { package = "sapling-util", version = "0.1.0", path = "../../../scm/lib/util" }
lazy_static = "1.5"
libc = "0.2.139"
parking_lot = { version = "0.12.1", features = ["send_guard"] }
Expand All @@ -32,6 +31,7 @@ sapling-atomicfile = { version = "0.1.0", path = "../../../scm/lib/atomicfile" }
sapling-config-remote-loader = { version = "0.1.0", path = "../../../scm/lib/config/remote-loader" }
sapling-http-client = { version = "0.1.0", path = "../../../scm/lib/http-client" }
sapling-thrift-types = { version = "0.1.0", path = "../../../scm/lib/thrift-types" }
sapling-util = { version = "0.1.0", path = "../../../scm/lib/util" }
serde = { version = "1.0.219", features = ["derive", "rc"] }
serde_json = { version = "1.0.140", features = ["alloc", "float_roundtrip", "raw_value", "unbounded_depth"] }
shlex = "1.3"
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/cli_rs/edenfs-client/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ use edenfs_utils::get_executable;
#[cfg(windows)]
use edenfs_utils::strip_unc_prefix;
use fbinit::expect_init;
use hg_util::lock::PathLock;
use tracing::Level;
use tracing::event;
use util::lock::PathLock;

use crate::client::EdenFsClient;
use crate::use_case::UseCase;
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/cli_rs/edenfs-client/src/redirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use edenfs_telemetry::EDEN_EVENTS_SCUBA;
use edenfs_telemetry::send;
use edenfs_utils::metadata::MetadataExt;
use edenfs_utils::remove_symlink;
use hg_util::path::absolute;
#[cfg(target_os = "windows")]
use mkscratch::zzencode;
use pathdiff::diff_paths;
Expand All @@ -38,6 +37,7 @@ use serde::Deserialize;
use serde::Deserializer;
use serde::Serialize;
use toml::value::Value;
use util::path::absolute;

use crate::checkout::CheckoutConfig;
use crate::checkout::EdenFsCheckout;
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/cli_rs/edenfs-client/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use anyhow::bail;
use hg_util::path::expand_path;
use util::path::expand_path;

use crate::instance::DEFAULT_CONFIG_DIR;
use crate::instance::DEFAULT_ETC_EDEN_DIR;
Expand Down
7 changes: 5 additions & 2 deletions eden/fs/inodes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ list(
REMOVE_ITEM
INODES_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/RequestContext.cpp
${CMAKE_CURRENT_SOURCE_DIR}/InodeNumber.cpp
${CMAKE_CURRENT_SOURCE_DIR}/InodeMetadata.cpp
${CMAKE_CURRENT_SOURCE_DIR}/InodeTimestamps.cpp
)

add_library(
eden_inodes_inodenumber STATIC
${CMAKE_CURRENT_SOURCE_DIR}/InodeNumber.cpp
InodeNumber.h
)

set_target_properties(eden_inodes_inodenumber PROPERTIES LINKER_LANGUAGE CXX)

target_link_libraries(
eden_inodes_inodenumber
PUBLIC
Expand Down Expand Up @@ -79,6 +80,7 @@ else()
PUBLIC
eden_fuse
eden_fscatalog
eden_fscatalog_dev
eden_lmdb_catalog
eden_overlay_checker
)
Expand Down Expand Up @@ -116,6 +118,7 @@ target_link_libraries(

add_subdirectory(overlay)
add_subdirectory(fscatalog)
add_subdirectory(fscatalog_dev)
add_subdirectory(memcatalog)
add_subdirectory(sqlitecatalog)
add_subdirectory(lmdbcatalog)
Expand Down
23 changes: 23 additions & 0 deletions eden/fs/inodes/fscatalog_dev/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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.

if (NOT WIN32)
file(GLOB OVERLAY_SRCS "*.cpp")
list(
REMOVE_ITEM OVERLAY_SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/eden_fsck.cpp"
)
add_library(
eden_fscatalog_dev STATIC
${OVERLAY_SRCS}
)
target_link_libraries(
eden_fscatalog_dev
PUBLIC
eden_overlay_thrift_cpp
eden_fuse
eden_utils
)
endif()
1 change: 1 addition & 0 deletions eden/fs/inodes/sqlitecatalog/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ target_link_libraries(
eden_model
eden_sqlite
eden_utils
edenfs_ffi
Folly::folly
${LIBGMOCK_LIBRARIES}
)
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/privhelper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.

file(GLOB PRIVHELPER_SRCS "*.cpp")
file(GLOB PRIVHELPER_SRCS "*.cpp" "priority/*.cpp")

add_library(
eden_fuse_privhelper STATIC
Expand Down
57 changes: 57 additions & 0 deletions eden/fs/rust/redirect_ffi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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.

# Due to some tools changing '-' to '_' when building,
# this library/crate is named using an '_' so that it can link successfully.
rust_static_library(rust_redirect_ffi CRATE redirect_ffi USE_CXX_INCLUDE)

install_rust_static_library(
rust_redirect_ffi
INSTALL_DIR lib
)

rust_cxx_bridge(
redirect_ffi
"src/lib.rs"
LIBS
fmt::fmt
Folly::folly
)

file(GLOB C_API_SRCS "src/*.cpp")
file(GLOB C_API_HDRS "include/*.h")
target_sources(
redirect_ffi
PRIVATE
"${C_API_SRCS}"
)

set_target_properties(
redirect_ffi
PROPERTIES
PUBLIC_HEADER
"${C_API_HDRS}"
)

target_include_directories(
redirect_ffi
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(
redirect_ffi
PUBLIC
rust_redirect_ffi
Folly::folly
edencommon::edencommon_utils
fmt::fmt
)

install(
TARGETS redirect_ffi
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION eden/scm/lib/redirect_ffi/include
)
9 changes: 8 additions & 1 deletion eden/fs/rust/redirect_ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# @generated by autocargo from //eden/fs/rust/redirect_ffi:redirect-ffi

[package]
name = "redirect-ffi"
name = "redirect_ffi"
version = "0.1.0"
authors = ["Facebook Source Control Team <[email protected]>"]
edition = "2024"
license = "GPLv2+"

[lib]
name = "redirect_ffi"
crate-type = ["lib", "staticlib"]

[dependencies]
anyhow = "1.0.98"
cxx = "1.0.119"
edenfs-client = { version = "0.1.0", path = "../../cli_rs/edenfs-client" }
tokio = { version = "1.47.1", features = ["full", "test-util", "tracing"] }

[build-dependencies]
cxx-build = "1.0.119"
11 changes: 0 additions & 11 deletions eden/fs/rust/redirect_ffi/build.rs

This file was deleted.

13 changes: 10 additions & 3 deletions eden/fs/service/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_fbthrift_library(
EdenService
DEPENDS
eden_config_thrift
fb303::fb303_thrift
fb303::fb303_core
)
add_fbthrift_library(
streamingeden_thrift
Expand All @@ -33,13 +33,14 @@ file(GLOB SERVICE_SRCS "*.cpp")
# eden/fs/thrift/ subdirectory, perhaps along with eden.thrift too.
list(
REMOVE_ITEM SERVICE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/PrettyPrinters.cpp
${CMAKE_CURRENT_SOURCE_DIR}/PrivHelperMain.cpp
)

add_library(
eden_service_thrift_util STATIC
PrettyPrinters.cpp
PrettyPrinters.h
)
set_target_properties(eden_service_thrift_util PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(
eden_service_thrift_util
PUBLIC
Expand All @@ -57,6 +58,11 @@ add_library(
eden_service STATIC
${SERVICE_SRCS}
)
target_link_options(
eden_service
PUBLIC
-Wl,--allow-multiple-definition
)
target_link_libraries(
eden_service
PUBLIC
Expand All @@ -71,6 +77,7 @@ target_link_libraries(
eden_store
eden_takeover
eden_telemetry
redirect_ffi
${EDEN_STORE_IMPLEMENTATIONS}
${YARPL_LIBRARIES}
Folly::folly
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/service/EdenServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

#include <csignal>

#include "common/network/Hostname.h"
#include "eden/common/telemetry/RequestMetricsScope.h"
#include "eden/common/telemetry/SessionInfo.h"
#include "eden/common/telemetry/StructuredLoggerFactory.h"
Expand Down Expand Up @@ -112,7 +113,6 @@

#ifdef EDEN_HAVE_SERVER_OBSERVER
#include "common/fb303/cpp/ThreadPoolExecutorCounters.h" // @manual
#include "common/network/Hostname.h"
#include "eden/fs/service/facebook/ServerObserver.h" // @manual
#endif

Expand Down
1 change: 1 addition & 0 deletions eden/scm/lib/backingstore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ target_link_libraries(
backingstore
PUBLIC
edencommon::edencommon_os
eden_config
rust_backingstore
fmt::fmt
Folly::folly
Expand Down
4 changes: 3 additions & 1 deletion eden/scm/lib/backingstore/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @generated by autocargo from //eden/scm/lib/backingstore:backingstore

[package]
name = "sapling-backingstore"
name = "backingstore"
version = "0.1.0"
authors = ["Meta Source Control Team <[email protected]>"]
edition = "2024"
Expand Down Expand Up @@ -45,4 +45,6 @@ tracing-subscriber = { version = "0.3.20", features = ["chrono", "env-filter", "
rand_chacha = "0.3"

[features]
cas = []
fb = ["sapling-configloader/fb"]
scuba = []
2 changes: 1 addition & 1 deletion eden/scm/lib/backingstore/benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"

[dependencies]
fbinit = { version = "0.2.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
sapling-backingstore = { version = "0.1.0", path = ".." }
backingstore = { version = "0.1.0", path = ".." }
sapling-configloader = { version = "0.1.0", path = "../../config/loader" }
sapling-identity = { version = "0.1.0", path = "../../identity" }
sapling-minibench = { version = "0.1.0", path = "../../minibench" }
Expand Down
Loading