Rename canonicalize into two functions:

* canonicalize_replace_cache
* canonicalize_replace_client

Now it is clear at the call site that if there are
duplicate copies of the data between the cache and
the caller, which copy gets replaced.

Additionally data parameter is now const-correct.
If it is not going to be replaced (canonicalize_replace_cache),
then the shared_ptr to the client data is const.
This commit is contained in:
Howard Hinnant
2020-03-05 15:53:12 -05:00
committed by manojsdoshi
parent e257a226f3
commit f22fcb3b2a
12 changed files with 42 additions and 24 deletions

View File

@@ -892,7 +892,7 @@ DatabaseShardImp::store(
auto [backend, pCache, nCache] = shard->getBackendAll();
auto nObj {NodeObject::createObject(type, std::move(data), hash)};
pCache->canonicalize(hash, nObj, true);
pCache->canonicalize_replace_cache(hash, nObj);
backend->store(nObj);
nCache->erase(hash);