From 3b6aa14fc85a2c12881f87df7647c4e6d9c4995f Mon Sep 17 00:00:00 2001 From: Chad Austin Date: Thu, 17 Nov 2022 19:56:38 -0800 Subject: [PATCH] backingstore: rename RustBackingStore and HgNativeBackingStore Summary: On the hg side, let's consistently use the namespace sapling, and instead of using the word "Rust" in the API, let's call them bindings. Reviewed By: xavierd Differential Revision: D40959727 fbshipit-source-id: 687c8c78fd69e2478dfbf5b0573c3bccec340ce3 --- eden/fs/store/hg/HgDatapackStore.h | 4 ++-- ...tBackingStore.h => BackingStoreBindings.h} | 0 ...tore.cpp => SaplingNativeBackingStore.cpp} | 24 +++++++++---------- ...ingStore.h => SaplingNativeBackingStore.h} | 12 ++++------ eden/scm/lib/backingstore/test/CBytesTest.cpp | 2 +- .../lib/backingstore/test/CFallibleTest.cpp | 2 +- eden/scm/lib/backingstore/tools/cbindgen.sh | 2 +- 7 files changed, 21 insertions(+), 25 deletions(-) rename eden/scm/lib/backingstore/c_api/{RustBackingStore.h => BackingStoreBindings.h} (100%) rename eden/scm/lib/backingstore/c_api/{HgNativeBackingStore.cpp => SaplingNativeBackingStore.cpp} (95%) rename eden/scm/lib/backingstore/c_api/{HgNativeBackingStore.h => SaplingNativeBackingStore.h} (89%) diff --git a/eden/fs/store/hg/HgDatapackStore.h b/eden/fs/store/hg/HgDatapackStore.h index 81731c92f0..8069be787a 100644 --- a/eden/fs/store/hg/HgDatapackStore.h +++ b/eden/fs/store/hg/HgDatapackStore.h @@ -12,7 +12,7 @@ #include "eden/fs/telemetry/RequestMetricsScope.h" #include "eden/fs/utils/PathFuncs.h" -#include "eden/scm/lib/backingstore/c_api/HgNativeBackingStore.h" +#include "eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h" namespace facebook::eden { @@ -97,7 +97,7 @@ class HgDatapackStore { } private: - HgNativeBackingStore store_; + sapling::SaplingNativeBackingStore store_; std::shared_ptr config_; mutable RequestMetricsScope::LockedRequestWatchList liveBatchedBlobWatches_; diff --git a/eden/scm/lib/backingstore/c_api/RustBackingStore.h b/eden/scm/lib/backingstore/c_api/BackingStoreBindings.h similarity index 100% rename from eden/scm/lib/backingstore/c_api/RustBackingStore.h rename to eden/scm/lib/backingstore/c_api/BackingStoreBindings.h diff --git a/eden/scm/lib/backingstore/c_api/HgNativeBackingStore.cpp b/eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.cpp similarity index 95% rename from eden/scm/lib/backingstore/c_api/HgNativeBackingStore.cpp rename to eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.cpp index 572442d636..d95a59e02d 100644 --- a/eden/scm/lib/backingstore/c_api/HgNativeBackingStore.cpp +++ b/eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.cpp @@ -5,7 +5,7 @@ * GNU General Public License version 2. */ -#include "eden/scm/lib/backingstore/c_api/HgNativeBackingStore.h" +#include "eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h" #include #include @@ -15,9 +15,7 @@ #include #include -namespace facebook::eden { - -using namespace sapling; +namespace sapling { namespace { /** @@ -116,7 +114,7 @@ void getTreeBatchCallback( } } // namespace -HgNativeBackingStore::HgNativeBackingStore( +SaplingNativeBackingStore::SaplingNativeBackingStore( std::string_view repository, const BackingStoreOptions& options) { CFallible store{ @@ -129,7 +127,7 @@ HgNativeBackingStore::HgNativeBackingStore( store_ = store.unwrap(); } -std::unique_ptr HgNativeBackingStore::getBlob( +std::unique_ptr SaplingNativeBackingStore::getBlob( folly::ByteRange name, folly::ByteRange node, bool local) { @@ -148,7 +146,7 @@ std::unique_ptr HgNativeBackingStore::getBlob( return bytesToIOBuf(result.unwrap().release()); } -std::shared_ptr HgNativeBackingStore::getBlobMetadata( +std::shared_ptr SaplingNativeBackingStore::getBlobMetadata( folly::ByteRange node, bool local) { XLOG(DBG7) << "Importing blob metadata" @@ -166,7 +164,7 @@ std::shared_ptr HgNativeBackingStore::getBlobMetadata( return result.unwrap(); } -void HgNativeBackingStore::getBlobMetadataBatch( +void SaplingNativeBackingStore::getBlobMetadataBatch( const std::vector>& requests, bool local, std::function)>&& resolve) { @@ -231,7 +229,7 @@ void HgNativeBackingStore::getBlobMetadataBatch( }); } -void HgNativeBackingStore::getBlobBatch( +void SaplingNativeBackingStore::getBlobBatch( const std::vector>& requests, bool local, std::function)>&& resolve) { @@ -295,7 +293,7 @@ void HgNativeBackingStore::getBlobBatch( }); } -void HgNativeBackingStore::getTreeBatch( +void SaplingNativeBackingStore::getTreeBatch( const std::vector>& requests, bool local, std::function)>&& resolve) { @@ -355,7 +353,7 @@ void HgNativeBackingStore::getTreeBatch( }); } -std::shared_ptr HgNativeBackingStore::getTree( +std::shared_ptr SaplingNativeBackingStore::getTree( folly::ByteRange node, bool local) { XLOG(DBG7) << "Importing tree node=" << folly::hexlify(node) @@ -373,10 +371,10 @@ std::shared_ptr HgNativeBackingStore::getTree( return manifest.unwrap(); } -void HgNativeBackingStore::flush() { +void SaplingNativeBackingStore::flush() { XLOG(DBG7) << "Flushing backing store"; sapling_backingstore_flush(store_.get()); } -} // namespace facebook::eden +} // namespace sapling diff --git a/eden/scm/lib/backingstore/c_api/HgNativeBackingStore.h b/eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h similarity index 89% rename from eden/scm/lib/backingstore/c_api/HgNativeBackingStore.h rename to eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h index a9b3cc1331..61e21a8f7a 100644 --- a/eden/scm/lib/backingstore/c_api/HgNativeBackingStore.h +++ b/eden/scm/lib/backingstore/c_api/SaplingNativeBackingStore.h @@ -11,19 +11,17 @@ #include #include -#include "eden/scm/lib/backingstore/c_api/RustBackingStore.h" +#include "eden/scm/lib/backingstore/c_api/BackingStoreBindings.h" namespace folly { class IOBuf; } // namespace folly -namespace facebook::eden { +namespace sapling { -using BackingStoreOptions = sapling::BackingStoreOptions; - -class HgNativeBackingStore { +class SaplingNativeBackingStore { public: - HgNativeBackingStore( + SaplingNativeBackingStore( std::string_view repository, const BackingStoreOptions& options); @@ -74,4 +72,4 @@ class HgNativeBackingStore { sapling::sapling_backingstore_free>::Ptr store_; }; -} // namespace facebook::eden +} // namespace sapling diff --git a/eden/scm/lib/backingstore/test/CBytesTest.cpp b/eden/scm/lib/backingstore/test/CBytesTest.cpp index 87c62bf709..ba33aee104 100644 --- a/eden/scm/lib/backingstore/test/CBytesTest.cpp +++ b/eden/scm/lib/backingstore/test/CBytesTest.cpp @@ -9,7 +9,7 @@ #include #include -#include "eden/scm/lib/backingstore/c_api/RustBackingStore.h" +#include "eden/scm/lib/backingstore/c_api/BackingStoreBindings.h" namespace { diff --git a/eden/scm/lib/backingstore/test/CFallibleTest.cpp b/eden/scm/lib/backingstore/test/CFallibleTest.cpp index 00ab4c10f7..2d95d4e2a9 100644 --- a/eden/scm/lib/backingstore/test/CFallibleTest.cpp +++ b/eden/scm/lib/backingstore/test/CFallibleTest.cpp @@ -8,7 +8,7 @@ #include #include -#include "eden/scm/lib/backingstore/c_api/RustBackingStore.h" +#include "eden/scm/lib/backingstore/c_api/BackingStoreBindings.h" namespace { diff --git a/eden/scm/lib/backingstore/tools/cbindgen.sh b/eden/scm/lib/backingstore/tools/cbindgen.sh index 744c8e85f9..4c0f512029 100755 --- a/eden/scm/lib/backingstore/tools/cbindgen.sh +++ b/eden/scm/lib/backingstore/tools/cbindgen.sh @@ -15,7 +15,7 @@ cd "$(dirname "$0")"/.. set -e CONFIG="cbindgen.toml" -OUTPUT="c_api/RustBackingStore.h" +OUTPUT="c_api/BackingStoreBindings.h" main() { cbindgen --config "$CONFIG" --output "$OUTPUT"