1818#include " eden/common/utils/ImmediateFuture.h"
1919#include " eden/common/utils/ProcessInfoCache.h"
2020#include " eden/common/utils/Throw.h"
21+ #include " eden/fs/config/ReloadableConfig.h"
2122#include " eden/fs/model/Blob.h"
2223#include " eden/fs/model/Tree.h"
2324#include " eden/fs/model/TreeAuxData.h"
@@ -48,7 +49,7 @@ std::shared_ptr<ObjectStore> ObjectStore::create(
4849 EdenStatsPtr stats,
4950 std::shared_ptr<ProcessInfoCache> processInfoCache,
5051 std::shared_ptr<StructuredLogger> structuredLogger,
51- std::shared_ptr<const EdenConfig > edenConfig,
52+ std::shared_ptr<ReloadableConfig > edenConfig,
5253 bool windowsSymlinksEnabled,
5354 CaseSensitivity caseSensitive) {
5455 return std::shared_ptr<ObjectStore>{new ObjectStore{
@@ -70,13 +71,13 @@ ObjectStore::ObjectStore(
7071 EdenStatsPtr stats,
7172 std::shared_ptr<ProcessInfoCache> processInfoCache,
7273 std::shared_ptr<StructuredLogger> structuredLogger,
73- std::shared_ptr<const EdenConfig > edenConfig,
74+ std::shared_ptr<ReloadableConfig > edenConfig,
7475 bool windowsSymlinksEnabled,
7576 CaseSensitivity caseSensitive)
76- : blobAuxDataCache_{std::in_place, edenConfig->metadataCacheSize .getValue ()},
77+ : blobAuxDataCache_{std::in_place, edenConfig->getEdenConfig ()-> metadataCacheSize .getValue ()},
7778 treeAuxDataCache_{
7879 std::in_place,
79- edenConfig->metadataCacheSize .getValue ()},
80+ edenConfig->getEdenConfig ()-> metadataCacheSize .getValue ()},
8081 treeCache_{std::move (treeCache)},
8182 backingStore_{std::move (backingStore)},
8283 localStore_{std::move (localStore)},
@@ -98,7 +99,8 @@ void ObjectStore::updateProcessFetch(
9899 const ObjectFetchContext& fetchContext) const {
99100 if (auto pid = fetchContext.getClientPid ()) {
100101 auto fetch_count = pidFetchCounts_->recordProcessFetch (pid.value ());
101- auto threshold = edenConfig_->fetchHeavyThreshold .getValue ();
102+ auto threshold =
103+ edenConfig_->getEdenConfig ()->fetchHeavyThreshold .getValue ();
102104 // indicate heavy event when fetch_count reaches multiple of threshold
103105 if (fetch_count && threshold && (fetch_count % threshold) == 0 ) {
104106 sendFetchHeavyEvent (pid.value (), fetch_count);
@@ -134,7 +136,8 @@ void ObjectStore::deprioritizeWhenFetchHeavy(
134136 ObjectFetchContext& context) const {
135137 if (auto pid = context.getClientPid ()) {
136138 auto fetch_count = pidFetchCounts_->getCountByPid (pid.value ());
137- auto threshold = edenConfig_->fetchHeavyThreshold .getValue ();
139+ auto threshold =
140+ edenConfig_->getEdenConfig ()->fetchHeavyThreshold .getValue ();
138141 if (threshold && fetch_count >= threshold) {
139142 context.deprioritize (kImportPriorityDeprioritizeAmount );
140143 }
@@ -325,7 +328,8 @@ void ObjectStore::maybeCacheTreeAndAuxInLocalStore(
325328 // Pre-warm the cache if there is tree aux data available
326329 if (treeResult.tree && treeResult.tree ->getAuxData ()) {
327330 if (shouldCacheTreeAuxData &&
328- edenConfig_->warmTreeAuxLocalCacheIfTreeFromBackingStore .getValue ()) {
331+ edenConfig_->getEdenConfig ()
332+ ->warmTreeAuxLocalCacheIfTreeFromBackingStore .getValue ()) {
329333 stats_->increment (
330334 &ObjectStoreStats::prewarmTreeAuxLocalCacheForTreeFromBackingStore);
331335 localStore_->putTreeAuxData (id, *treeResult.tree ->getAuxData ());
@@ -339,7 +343,8 @@ void ObjectStore::maybeCacheTreeAuxInMemCache(
339343 const ObjectId& id,
340344 const BackingStore::GetTreeResult& treeResult) const {
341345 if (treeResult.tree && treeResult.tree ->getAuxData () &&
342- edenConfig_->warmTreeAuxMemCacheIfTreeFromBackingStore .getValue ()) {
346+ edenConfig_->getEdenConfig ()
347+ ->warmTreeAuxMemCacheIfTreeFromBackingStore .getValue ()) {
343348 stats_->increment (
344349 &ObjectStoreStats::prewarmTreeAuxMemCacheForTreeFromBackingStore);
345350 treeAuxDataCache_.wlock ()->set (id, *treeResult.tree ->getAuxData ());
@@ -366,8 +371,8 @@ folly::SemiFuture<BackingStore::GetTreeResult> ObjectStore::getTreeImpl(
366371 &ObjectStoreStats::getTreeLocalstoreDuration,
367372 watch.elapsed ());
368373 if (tree->getAuxData () == nullptr &&
369- self->edenConfig_ ->warmTreeAuxCacheIfTreeFromLocalStore
370- .getValue ()) {
374+ self->edenConfig_ ->getEdenConfig ()
375+ -> warmTreeAuxCacheIfTreeFromLocalStore .getValue ()) {
371376 // The tree stored locally does not have Tree Aux Data attached.
372377 // This means the Tree was fetched before Tree serialization V2
373378 // and before we support TreeAuxData included in Tree response
@@ -883,7 +888,10 @@ ImmediateFuture<Hash20> ObjectStore::getBlobSha1(
883888
884889Hash32 ObjectStore::computeBlake3 (const Blob& blob) const {
885890 const auto content = blob.getContents ();
886- const auto & maybeBlakeKey = edenConfig_->blake3Key .getValue ();
891+ // This should maybe be read at startup and saved in a member variable, but in
892+ // practice this key should never change.
893+ const auto & maybeBlakeKey =
894+ edenConfig_->getEdenConfig ()->blake3Key .getValue ();
887895 return maybeBlakeKey ? Hash32::keyedBlake3 (
888896 folly::ByteRange{folly::StringPiece{
889897 maybeBlakeKey->data (), maybeBlakeKey->size ()}},
0 commit comments