diff --git a/eden/fs/store/BackingStore.h b/eden/fs/store/BackingStore.h index 2310468449..228ba1d4c9 100644 --- a/eden/fs/store/BackingStore.h +++ b/eden/fs/store/BackingStore.h @@ -49,10 +49,6 @@ class BackingStore { virtual folly::SemiFuture> getTreeForCommit( const Hash& commitID, ObjectFetchContext& context) = 0; - virtual folly::SemiFuture> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) = 0; FOLLY_NODISCARD virtual folly::SemiFuture prefetchBlobs( const std::vector& /*ids*/, ObjectFetchContext& /*context*/) { diff --git a/eden/fs/store/EmptyBackingStore.cpp b/eden/fs/store/EmptyBackingStore.cpp index 5058863a71..f972f86d7e 100644 --- a/eden/fs/store/EmptyBackingStore.cpp +++ b/eden/fs/store/EmptyBackingStore.cpp @@ -45,12 +45,5 @@ SemiFuture> EmptyBackingStore::getTreeForCommit( std::domain_error("empty backing store")); } -SemiFuture> EmptyBackingStore::getTreeForManifest( - const Hash& /* commitID */, - const Hash& /* manifestID */, - ObjectFetchContext& /* context */) { - return makeSemiFuture>( - std::domain_error("empty backing store")); -} } // namespace eden } // namespace facebook diff --git a/eden/fs/store/EmptyBackingStore.h b/eden/fs/store/EmptyBackingStore.h index 0d0b70c791..653cf95f27 100644 --- a/eden/fs/store/EmptyBackingStore.h +++ b/eden/fs/store/EmptyBackingStore.h @@ -31,10 +31,6 @@ class EmptyBackingStore : public BackingStore { folly::SemiFuture> getTreeForCommit( const Hash& commitID, ObjectFetchContext& context) override; - folly::SemiFuture> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) override; }; } // namespace eden } // namespace facebook diff --git a/eden/fs/store/IObjectStore.h b/eden/fs/store/IObjectStore.h index d75837ed26..d3aa2a6958 100644 --- a/eden/fs/store/IObjectStore.h +++ b/eden/fs/store/IObjectStore.h @@ -49,10 +49,6 @@ class IObjectStore { virtual folly::Future> getTreeForCommit( const Hash& commitID, ObjectFetchContext& context) const = 0; - virtual folly::Future> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) const = 0; virtual folly::Future prefetchBlobs( const std::vector& ids, ObjectFetchContext& context) const = 0; diff --git a/eden/fs/store/ObjectStore.cpp b/eden/fs/store/ObjectStore.cpp index 0619d61157..9aeef37d8d 100644 --- a/eden/fs/store/ObjectStore.cpp +++ b/eden/fs/store/ObjectStore.cpp @@ -201,33 +201,6 @@ Future> ObjectStore::getTreeForCommit( }); } -Future> ObjectStore::getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) const { - XLOG(DBG3) << "getTreeForManifest(" << commitID << ", " << manifestID << ")"; - - return backingStore_->getTreeForManifest(commitID, manifestID, context) - .via(executor_) - .thenValue([treeCache = treeCache_, - commitID, - manifestID, - localStore = localStore_, - edenConfig = edenConfig_](std::shared_ptr tree) { - if (!tree) { - throw std::domain_error(folly::to( - "unable to import commit ", - commitID.toString(), - " with manifest node ", - manifestID.toString())); - } - - localStore->putTree(tree.get()); - treeCache->insert(tree); - return tree; - }); -} - folly::Future ObjectStore::prefetchBlobs( const std::vector& ids, ObjectFetchContext& fetchContext) const { diff --git a/eden/fs/store/ObjectStore.h b/eden/fs/store/ObjectStore.h index 5a4b3b2b29..9014cbc89d 100644 --- a/eden/fs/store/ObjectStore.h +++ b/eden/fs/store/ObjectStore.h @@ -130,11 +130,6 @@ class ObjectStore : public IObjectStore, const Hash& commitID, ObjectFetchContext& context) const override; - folly::Future> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) const override; - folly::Future prefetchBlobs( const std::vector& ids, ObjectFetchContext& context) const override; diff --git a/eden/fs/store/git/GitBackingStore.cpp b/eden/fs/store/git/GitBackingStore.cpp index 4ef6a44ce1..ffd23c9de6 100644 --- a/eden/fs/store/git/GitBackingStore.cpp +++ b/eden/fs/store/git/GitBackingStore.cpp @@ -192,13 +192,6 @@ SemiFuture> GitBackingStore::getTreeForCommit( }); } -SemiFuture> GitBackingStore::getTreeForManifest( - const Hash& commitID, - const Hash& /* manifestID */, - ObjectFetchContext& context) { - return getTreeForCommit(commitID, context); -} - git_oid GitBackingStore::hash2Oid(const Hash& hash) { git_oid oid; static_assert( diff --git a/eden/fs/store/git/GitBackingStore.h b/eden/fs/store/git/GitBackingStore.h index e3ca422109..e026433d29 100644 --- a/eden/fs/store/git/GitBackingStore.h +++ b/eden/fs/store/git/GitBackingStore.h @@ -53,10 +53,6 @@ class GitBackingStore : public BackingStore { folly::SemiFuture> getTreeForCommit( const Hash& commitID, ObjectFetchContext& context) override; - folly::SemiFuture> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) override; private: GitBackingStore(GitBackingStore const&) = delete; diff --git a/eden/fs/store/hg/HgBackingStore.cpp b/eden/fs/store/hg/HgBackingStore.cpp index 61b04ad1a3..048e09b7cc 100644 --- a/eden/fs/store/hg/HgBackingStore.cpp +++ b/eden/fs/store/hg/HgBackingStore.cpp @@ -631,17 +631,6 @@ SemiFuture> HgBackingStore::getTreeForCommit( }); } -folly::SemiFuture> HgBackingStore::getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - bool prefetchMetadata) { - // Construct the edenTreeID to pass to localStore lookup - auto rootTreeHash = - HgProxyHash::prepareToStore(RelativePathPiece{}, manifestID).first; - return getTreeForRootTreeImpl(commitID, rootTreeHash, prefetchMetadata) - .via(serverThreadPool_); -} - folly::Future> HgBackingStore::getTreeForRootTreeImpl( const Hash& commitID, const Hash& rootTreeHash, diff --git a/eden/fs/store/hg/HgBackingStore.h b/eden/fs/store/hg/HgBackingStore.h index 9694379806..b20c59819d 100644 --- a/eden/fs/store/hg/HgBackingStore.h +++ b/eden/fs/store/hg/HgBackingStore.h @@ -81,10 +81,6 @@ class HgBackingStore { folly::SemiFuture> getTreeForCommit( const Hash& commitID, bool prefetchMetadata); - folly::SemiFuture> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - bool prefetchMetadata); FOLLY_NODISCARD folly::SemiFuture prefetchBlobs( std::vector ids, ObjectFetchContext& context); diff --git a/eden/fs/store/hg/HgQueuedBackingStore.cpp b/eden/fs/store/hg/HgQueuedBackingStore.cpp index dfac422016..a3a0336ee0 100644 --- a/eden/fs/store/hg/HgQueuedBackingStore.cpp +++ b/eden/fs/store/hg/HgQueuedBackingStore.cpp @@ -335,15 +335,6 @@ folly::SemiFuture> HgQueuedBackingStore::getTreeForCommit( return backingStore_->getTreeForCommit(commitID, context.prefetchMetadata()); } -folly::SemiFuture> -HgQueuedBackingStore::getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) { - return backingStore_->getTreeForManifest( - commitID, manifestID, context.prefetchMetadata()); -} - folly::SemiFuture HgQueuedBackingStore::prefetchBlobs( const std::vector& ids, ObjectFetchContext& context) { diff --git a/eden/fs/store/hg/HgQueuedBackingStore.h b/eden/fs/store/hg/HgQueuedBackingStore.h index f7009cccbf..7a57a676a6 100644 --- a/eden/fs/store/hg/HgQueuedBackingStore.h +++ b/eden/fs/store/hg/HgQueuedBackingStore.h @@ -123,10 +123,6 @@ class HgQueuedBackingStore : public BackingStore { folly::SemiFuture> getTreeForCommit( const Hash& commitID, ObjectFetchContext& context) override; - folly::SemiFuture> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) override; FOLLY_NODISCARD virtual folly::SemiFuture prefetchBlobs( const std::vector& ids, diff --git a/eden/fs/store/hg/test/HgBackingStoreTest.cpp b/eden/fs/store/hg/test/HgBackingStoreTest.cpp index 8dbdc0c6ea..f2a9723f92 100644 --- a/eden/fs/store/hg/test/HgBackingStoreTest.cpp +++ b/eden/fs/store/hg/test/HgBackingStoreTest.cpp @@ -152,18 +152,6 @@ TEST_F( ::testing::ElementsAre(PathComponent{"foo"}, PathComponent{"src"})); } -TEST_F(HgBackingStoreTest, getTreeForManifest) { - auto tree1 = - objectStore - ->getTreeForCommit(commit1, ObjectFetchContext::getNullContext()) - .get(0ms); - auto tree2 = objectStore - ->getTreeForManifest( - commit1, manifest1, ObjectFetchContext::getNullContext()) - .get(0ms); - EXPECT_EQ(tree1->getHash(), tree2->getHash()); -} - TEST_F(HgBackingStoreTest, skipMetadataPrefetch) { auto metadataImporter = dynamic_cast( &(backingStore->getHgBackingStore().getMetadataImporter())); diff --git a/eden/fs/store/recas/ReCasBackingStore.cpp b/eden/fs/store/recas/ReCasBackingStore.cpp index 9bb299cff0..cc0f18b489 100644 --- a/eden/fs/store/recas/ReCasBackingStore.cpp +++ b/eden/fs/store/recas/ReCasBackingStore.cpp @@ -40,12 +40,6 @@ folly::SemiFuture> ReCasBackingStore::getTreeForCommit( ObjectFetchContext& /** context **/) { throw std::domain_error("unimplemented"); }; -folly::SemiFuture> ReCasBackingStore::getTreeForManifest( - const Hash& /** commitID **/, - const Hash& /** manifestID **/, - ObjectFetchContext& /** context **/) { - throw std::domain_error("unimplemented"); -}; } // namespace eden } // namespace facebook diff --git a/eden/fs/store/recas/ReCasBackingStore.h b/eden/fs/store/recas/ReCasBackingStore.h index 8179860f98..9dc5ccdf2d 100644 --- a/eden/fs/store/recas/ReCasBackingStore.h +++ b/eden/fs/store/recas/ReCasBackingStore.h @@ -29,10 +29,6 @@ class ReCasBackingStore : public BackingStore { folly::SemiFuture> getTreeForCommit( const Hash& commitID, ObjectFetchContext& context) override; - folly::SemiFuture> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context) override; private: // Forbidden copy constructor and assignment operator diff --git a/eden/fs/store/recas/test/ReCasBackingStoreTest.cpp b/eden/fs/store/recas/test/ReCasBackingStoreTest.cpp index 43637b3b84..ec38052ce7 100644 --- a/eden/fs/store/recas/test/ReCasBackingStoreTest.cpp +++ b/eden/fs/store/recas/test/ReCasBackingStoreTest.cpp @@ -57,14 +57,3 @@ TEST_F(ReCasBackingStoreTest, getTreeForCommit) { .get(kTestTimeout), std::domain_error); } - -TEST_F(ReCasBackingStoreTest, getTreeForManifest) { - auto reCasStore = makeReCasBackingStore(); - EXPECT_THROW( - reCasStore - ->getTreeForManifest( - id, manifest, ObjectFetchContext::getNullContext()) - .via(&folly::QueuedImmediateExecutor::instance()) - .get(kTestTimeout), - std::domain_error); -} diff --git a/eden/fs/testharness/FakeBackingStore.h b/eden/fs/testharness/FakeBackingStore.h index cec2d9e27b..58a3bd272f 100644 --- a/eden/fs/testharness/FakeBackingStore.h +++ b/eden/fs/testharness/FakeBackingStore.h @@ -48,10 +48,12 @@ class FakeBackingStore : public BackingStore { folly::SemiFuture> getTreeForCommit( const Hash& commitID, ObjectFetchContext& context) override; + folly::SemiFuture> getTreeForManifest( const Hash& commitID, const Hash& manifestID, - ObjectFetchContext& context) override; + ObjectFetchContext& context); + /** * Add a Blob to the backing store * diff --git a/eden/fs/testharness/FakeObjectStore.cpp b/eden/fs/testharness/FakeObjectStore.cpp index 9ab0eb65a6..b08642040f 100644 --- a/eden/fs/testharness/FakeObjectStore.cpp +++ b/eden/fs/testharness/FakeObjectStore.cpp @@ -79,13 +79,6 @@ Future> FakeObjectStore::getTreeForCommit( return makeFuture(make_shared(iter->second)); } -folly::Future> FakeObjectStore::getTreeForManifest( - const Hash& commitID, - const Hash& /* manifestID */, - ObjectFetchContext&) const { - return getTreeForCommit(commitID); -} - folly::Future FakeObjectStore::prefetchBlobs( const std::vector&, ObjectFetchContext&) const { diff --git a/eden/fs/testharness/FakeObjectStore.h b/eden/fs/testharness/FakeObjectStore.h index 4ed88ee4f7..ece65f6178 100644 --- a/eden/fs/testharness/FakeObjectStore.h +++ b/eden/fs/testharness/FakeObjectStore.h @@ -45,11 +45,6 @@ class FakeObjectStore : public IObjectStore { const Hash& commitID, ObjectFetchContext& context = ObjectFetchContext::getNullContext()) const override; - folly::Future> getTreeForManifest( - const Hash& commitID, - const Hash& manifestID, - ObjectFetchContext& context = - ObjectFetchContext::getNullContext()) const override; folly::Future prefetchBlobs( const std::vector& ids, ObjectFetchContext& context = diff --git a/eden/fs/testharness/test/FakeBackingStoreTest.cpp b/eden/fs/testharness/test/FakeBackingStoreTest.cpp index e1fd627b46..82a0473aed 100644 --- a/eden/fs/testharness/test/FakeBackingStoreTest.cpp +++ b/eden/fs/testharness/test/FakeBackingStoreTest.cpp @@ -280,74 +280,6 @@ TEST_F(FakeBackingStoreTest, getTreeForCommit) { "tree .* for commit .* not found"); } -TEST_F(FakeBackingStoreTest, getTreeForManifest) { - // Set up one commit with a root tree - auto dir1Hash = makeTestHash("abc"); - auto* dir1 = store_->putTree(dir1Hash, {{"foo", store_->putBlob("foo\n")}}); - auto hash1 = makeTestHash("1"); - auto* commit1 = store_->putCommit(hash1, dir1); - // Set up a second commit, but don't actually add the tree object for this one - auto hash2 = makeTestHash("2"); - auto hash3 = makeTestHash("3"); - store_->putCommit(hash2, hash3); - - auto future1 = store_->getTreeForManifest( - hash1, dir1Hash, ObjectFetchContext::getNullContext()); - // Since we are not looking up the commit hash, but since the tree exists, we - // are waiting on the tree to be triggered - EXPECT_FALSE(future1.isReady()); - - auto future2 = store_->getTreeForManifest( - hash2, hash3, ObjectFetchContext::getNullContext()); - // Since we are not looking up the commit hash, and since the tree does not - // exist, we are not waiting on the tree to be triggered to resolve this. - EXPECT_TRUE(future2.isReady()); - // This should cause future2 to fail since the tree does not actually exist. - EXPECT_THROW_RE( - std::move(future2).get(), - std::domain_error, - "tree .* for commit .* not found"); - - // Trigger the tree, the first future should be ready. - dir1->trigger(); - ASSERT_TRUE(future1.isReady()); - EXPECT_EQ(dir1Hash, std::move(future1).get()->getHash()); - - // Get another future for commit1 - auto future3 = store_->getTreeForManifest( - hash1, dir1Hash, ObjectFetchContext::getNullContext()); - EXPECT_FALSE(future3.isReady()); - // Triggering the directory now should have an effect since we are not waiting - // to look up the manifest id using the commit hash and are only waiting on - // the directory - dir1->trigger(); - EXPECT_TRUE(future3.isReady()); - EXPECT_EQ(dir1Hash, std::move(future3).get()->getHash()); - - // Try triggering errors - auto future4 = store_->getTreeForManifest( - hash1, dir1Hash, ObjectFetchContext::getNullContext()); - EXPECT_FALSE(future4.isReady()); - commit1->triggerError(std::runtime_error("bad luck")); - EXPECT_FALSE(future4.isReady()); - dir1->trigger(); - EXPECT_TRUE(future4.isReady()); - // Since getTreeForManifest does not depend on the commit to get the tree, and - // since the tree is already in the store, an error being triggered with the - // commit will not cause getTreeForManifest to fail - EXPECT_EQ(dir1Hash, std::move(future4).get()->getHash()); - - auto future5 = store_->getTreeForManifest( - hash1, dir1Hash, ObjectFetchContext::getNullContext()); - EXPECT_FALSE(future5.isReady()); - commit1->trigger(); - EXPECT_FALSE(future5.isReady()); - dir1->triggerError(std::runtime_error("PC Load Letter")); - ASSERT_TRUE(future5.isReady()); - EXPECT_THROW_RE( - std::move(future5).get(), std::runtime_error, "PC Load Letter"); -} - TEST_F(FakeBackingStoreTest, maybePutBlob) { auto foo1 = store_->maybePutBlob("foo\n"); EXPECT_TRUE(foo1.second);