Pass getTreeEntryForRootId to ObjectStore

Summary: This will add the same getTreeEntryForRootId to ObjectStore

Reviewed By: chadaustin

Differential Revision: D29920475

fbshipit-source-id: 15bfc6a2ba70cce2095dfcf1f434fd7087605e04
This commit is contained in:
Yipu Miao 2021-08-20 17:10:06 -07:00 committed by Facebook GitHub Bot
parent a721dd3ef3
commit ff67f9214e
2 changed files with 28 additions and 0 deletions

View File

@ -138,6 +138,21 @@ Future<shared_ptr<const Tree>> ObjectStore::getRootTree(
});
}
folly::Future<std::shared_ptr<TreeEntry>> 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<shared_ptr<const Tree>> ObjectStore::getTree(
const Hash& id,
ObjectFetchContext& fetchContext) const {

View File

@ -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<std::shared_ptr<TreeEntry>> getTreeEntryForRootId(
const RootId& rootId,
facebook::eden::TreeEntryType treeEntryType,
facebook::eden::PathComponentPiece pathComponentPiece,
ObjectFetchContext& context) const;
/**
* Get a Tree by ID.
*