mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
2a9e1e2f29
Summary: Now that the import bug has been fixed for some time, it's likely few people have cached empty files. And if they do, `eden gc; eden restart` is a fine workaround. On the other hand, reimporting empty files gums up the importer, and I've seen several people recently complaining about performance that could be partially attributed to the fact that their Eden needed to verify empty files. simpkins has talked about adding a bit to the cached blob to determine whether it needs reimporting or not, but it's probably going to take a while for anyone to implement that, and this reverification logic is hurting people today. Reviewed By: strager Differential Revision: D10456519 fbshipit-source-id: 657bc377ee16ce93494075bde4388aed59dceecf
57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2016-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include <folly/futures/Future.h>
|
|
#include <memory>
|
|
|
|
namespace folly {
|
|
template <typename T>
|
|
class Future;
|
|
}
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
class Blob;
|
|
class Hash;
|
|
class Tree;
|
|
|
|
/**
|
|
* Abstract interface for a BackingStore.
|
|
*
|
|
* A BackingStore fetches tree and blob information from an external
|
|
* authoritative data source.
|
|
*
|
|
* BackingStore implementations must be thread-safe, and perform their own
|
|
* internal locking.
|
|
*/
|
|
class BackingStore {
|
|
public:
|
|
BackingStore() {}
|
|
virtual ~BackingStore() {}
|
|
|
|
virtual folly::Future<std::unique_ptr<Tree>> getTree(const Hash& id) = 0;
|
|
virtual folly::Future<std::unique_ptr<Blob>> getBlob(const Hash& id) = 0;
|
|
virtual folly::Future<std::unique_ptr<Tree>> getTreeForCommit(
|
|
const Hash& commitID) = 0;
|
|
FOLLY_NODISCARD virtual folly::Future<folly::Unit> prefetchBlobs(
|
|
const std::vector<Hash>& ids) const {
|
|
return folly::unit;
|
|
}
|
|
|
|
private:
|
|
// Forbidden copy constructor and assignment operator
|
|
BackingStore(BackingStore const&) = delete;
|
|
BackingStore& operator=(BackingStore const&) = delete;
|
|
};
|
|
} // namespace eden
|
|
} // namespace facebook
|