mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
remove the deprecated ObjectStore::getTree() API
Summary: Remove the blocking getTree() API. All call sites are using getTreeFuture() instead now. I plan to rename getTreeFuture() to getTree() in a subsequent diff. Reviewed By: wez Differential Revision: D5295725 fbshipit-source-id: 6b40b4c808da94a9c68decae3ce38c7d13fbe9f5
This commit is contained in:
parent
5740a0645b
commit
9cd3d175e0
@ -28,7 +28,6 @@ class IObjectStore {
|
||||
public:
|
||||
virtual ~IObjectStore() {}
|
||||
|
||||
virtual std::unique_ptr<Tree> getTree(const Hash& id) const = 0;
|
||||
virtual std::unique_ptr<Blob> getBlob(const Hash& id) const = 0;
|
||||
|
||||
/**
|
||||
|
@ -37,10 +37,6 @@ ObjectStore::ObjectStore(
|
||||
|
||||
ObjectStore::~ObjectStore() {}
|
||||
|
||||
unique_ptr<Tree> ObjectStore::getTree(const Hash& id) const {
|
||||
return getTreeFuture(id).get();
|
||||
}
|
||||
|
||||
Future<unique_ptr<Tree>> ObjectStore::getTreeFuture(const Hash& id) const {
|
||||
// Check in the LocalStore first
|
||||
auto tree = localStore_->getTree(id);
|
||||
|
@ -38,16 +38,6 @@ class ObjectStore : public IObjectStore {
|
||||
std::shared_ptr<BackingStore> backingStore);
|
||||
~ObjectStore() override;
|
||||
|
||||
/**
|
||||
* Get a Tree by ID.
|
||||
*
|
||||
* This function never returns nullptr. It throws std::domain_error if the
|
||||
* specified tree ID does not exist, or possibly other exceptions on error.
|
||||
*
|
||||
* TODO: This API will be deprecated in favor of getTreeFuture()
|
||||
*/
|
||||
std::unique_ptr<Tree> getTree(const Hash& id) const override;
|
||||
|
||||
/**
|
||||
* Get a Blob by ID.
|
||||
*
|
||||
|
@ -53,10 +53,6 @@ void FakeObjectStore::setTreeForCommit(const Hash& commitID, Tree&& tree) {
|
||||
}
|
||||
}
|
||||
|
||||
unique_ptr<Tree> FakeObjectStore::getTree(const Hash& id) const {
|
||||
return getTreeFuture(id).get();
|
||||
}
|
||||
|
||||
Future<std::unique_ptr<Tree>> FakeObjectStore::getTreeFuture(
|
||||
const Hash& id) const {
|
||||
auto iter = trees_.find(id);
|
||||
|
@ -33,7 +33,6 @@ class FakeObjectStore : public IObjectStore {
|
||||
void addBlob(Blob&& blob);
|
||||
void setTreeForCommit(const Hash& commitID, Tree&& tree);
|
||||
|
||||
std::unique_ptr<Tree> getTree(const Hash& id) const override;
|
||||
std::unique_ptr<Blob> getBlob(const Hash& id) const override;
|
||||
Hash getSha1ForBlob(const Hash& id) const override;
|
||||
|
||||
|
@ -32,13 +32,13 @@ Hash blobHash("5555555555555555555555555555555555555555");
|
||||
TEST(FakeObjectStore, getObjectsOfAllTypesFromStore) {
|
||||
FakeObjectStore store;
|
||||
|
||||
// Test getTree().
|
||||
// Test getTreeFuture().
|
||||
vector<TreeEntry> entries1;
|
||||
uint8_t rw_ = 0b110;
|
||||
entries1.emplace_back(fileHash, "a_file", FileType::REGULAR_FILE, rw_);
|
||||
Tree tree1(std::move(entries1), tree1Hash);
|
||||
store.addTree(std::move(tree1));
|
||||
auto foundTree = store.getTree(tree1Hash);
|
||||
auto foundTree = store.getTreeFuture(tree1Hash).get();
|
||||
EXPECT_TRUE(foundTree);
|
||||
EXPECT_EQ(tree1Hash, foundTree->getHash());
|
||||
|
||||
@ -75,7 +75,7 @@ TEST(FakeObjectStore, getObjectsOfAllTypesFromStore) {
|
||||
TEST(FakeObjectStore, getMissingObjectThrows) {
|
||||
FakeObjectStore store;
|
||||
Hash hash("4242424242424242424242424242424242424242");
|
||||
EXPECT_THROW(store.getTree(hash), std::domain_error);
|
||||
EXPECT_THROW(store.getTreeFuture(hash).get(), std::domain_error);
|
||||
EXPECT_THROW(store.getBlob(hash), std::domain_error);
|
||||
EXPECT_THROW(store.getTreeForCommit(hash).get(), std::domain_error);
|
||||
EXPECT_THROW(store.getSha1ForBlob(hash), std::domain_error);
|
||||
|
Loading…
Reference in New Issue
Block a user