mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
add hg:use-datapack
config option to gate datapack related behaivor
Summary: This allows us to test the datapack code easier without rebuilding Eden. Reviewed By: wez Differential Revision: D17468473 fbshipit-source-id: a6807b4d6e747ae8557ae51fdf798de2a54fd4f1
This commit is contained in:
parent
e804f5277f
commit
56525d88b6
@ -176,6 +176,13 @@ class EdenConfig : public ConfigSettingManager {
|
||||
return fuseDaemonTimeout_.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls if Eden reads from Mercurial's datapack store.
|
||||
*/
|
||||
bool getUseDatapack() const {
|
||||
return useDatapack_.getValue();
|
||||
}
|
||||
|
||||
void setUserConfigPath(AbsolutePath userConfigPath);
|
||||
|
||||
void setSystemConfigDir(AbsolutePath systemConfigDir);
|
||||
@ -317,6 +324,8 @@ class EdenConfig : public ConfigSettingManager {
|
||||
"fuse:daemon-timeout",
|
||||
std::chrono::nanoseconds::max(),
|
||||
this};
|
||||
|
||||
ConfigSetting<bool> useDatapack_{"hg:use-datapack", false, this};
|
||||
};
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -664,19 +664,23 @@ folly::Future<Hash> HgBackingStore::importTreeManifest(const Hash& commitId) {
|
||||
}
|
||||
|
||||
Future<unique_ptr<Blob>> HgBackingStore::getBlob(const Hash& id) {
|
||||
auto edenConfig = config_->getEdenConfig();
|
||||
|
||||
// Look up the mercurial path and file revision hash,
|
||||
// which we need to import the data from mercurial
|
||||
HgProxyHash hgInfo(localStore_, id, "importFileContents");
|
||||
|
||||
#if EDEN_HAVE_RUST_DATAPACK
|
||||
if (useDatapackGetBlob_ && datapackStore_) {
|
||||
if (edenConfig->getUseDatapack() && datapackStore_) {
|
||||
if (auto content = datapackStore_->getBlob(id, hgInfo)) {
|
||||
XLOG(DBG5) << "importing file contents of '" << hgInfo.path() << "', "
|
||||
<< hgInfo.revHash().toString() << " from datapack store";
|
||||
return makeFuture(std::move(content));
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
// Prefer using the above rust implementation over the C++ implementation
|
||||
if (useDatapackGetBlob_ && unionStore_) {
|
||||
if (edenConfig->getUseDatapack() && unionStore_) {
|
||||
auto content = getBlobFromUnionStore(*unionStore_->wlock(), id, hgInfo);
|
||||
if (content) {
|
||||
return makeFuture(std::move(content));
|
||||
|
@ -198,7 +198,6 @@ class HgBackingStore : public BackingStore {
|
||||
// UnionDatapackStore is alive.
|
||||
std::vector<std::unique_ptr<DatapackStore>> dataPackStores_;
|
||||
std::unique_ptr<folly::Synchronized<UnionDatapackStore>> unionStore_;
|
||||
bool useDatapackGetBlob_{false};
|
||||
|
||||
std::string repoName_;
|
||||
folly::Synchronized<std::shared_ptr<BackingStore>> mononoke_;
|
||||
|
Loading…
Reference in New Issue
Block a user