From ff67f9214ed746df046837cbe91ee9e03ca00841 Mon Sep 17 00:00:00 2001 From: Yipu Miao Date: Fri, 20 Aug 2021 17:10:06 -0700 Subject: [PATCH] Pass getTreeEntryForRootId to ObjectStore Summary: This will add the same getTreeEntryForRootId to ObjectStore Reviewed By: chadaustin Differential Revision: D29920475 fbshipit-source-id: 15bfc6a2ba70cce2095dfcf1f434fd7087605e04 --- eden/fs/store/ObjectStore.cpp | 15 +++++++++++++++ eden/fs/store/ObjectStore.h | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/eden/fs/store/ObjectStore.cpp b/eden/fs/store/ObjectStore.cpp index ed28145ffa..acaf3cff21 100644 --- a/eden/fs/store/ObjectStore.cpp +++ b/eden/fs/store/ObjectStore.cpp @@ -138,6 +138,21 @@ Future> ObjectStore::getRootTree( }); } +folly::Future> ObjectStore::getTreeEntryForRootId( + const RootId& rootId, + facebook::eden::TreeEntryType treeEntryType, + facebook::eden::PathComponentPiece pathComponentPiece, + ObjectFetchContext& context) const { + XLOG(DBG3) << "getTreeEntryForRootId(" << rootId << ")"; + + // TODO: We can cache the treeEntry to the localStore like Tree or + // blob + return backingStore_ + ->getTreeEntryForRootId( + rootId, treeEntryType, pathComponentPiece, context) + .via(executor_); +} + Future> ObjectStore::getTree( const Hash& id, ObjectFetchContext& fetchContext) const { diff --git a/eden/fs/store/ObjectStore.h b/eden/fs/store/ObjectStore.h index a25b7e4eeb..b2e060a330 100644 --- a/eden/fs/store/ObjectStore.h +++ b/eden/fs/store/ObjectStore.h @@ -131,6 +131,19 @@ class ObjectStore : public IObjectStore, const RootId& rootId, ObjectFetchContext& context) const override; + /** + * Get a TreeEntry by ID + * + * This returns a Future object that will produce the TreeEntry when it is + * ready. It may result in a std::domain_error if the specified tree ID does + * not exist, or possibly other exceptions on error. + */ + folly::Future> getTreeEntryForRootId( + const RootId& rootId, + facebook::eden::TreeEntryType treeEntryType, + facebook::eden::PathComponentPiece pathComponentPiece, + ObjectFetchContext& context) const; + /** * Get a Tree by ID. *