Skip to content

Commit

Permalink
Rename functions related to ContentAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
meditans committed Jul 14, 2020
1 parent ff07296 commit ade0f1a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/libstore/daemon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
auto paths = readStorePaths<StorePathSet>(*store, from);
std::set<StorePathDescriptor> caPaths;
if (GET_PROTOCOL_MINOR(clientVersion) > 22)
caPaths = readContentAddressSet(*store, from);
caPaths = readStorePathDescriptorSet(*store, from);
logger->startWork();
store->querySubstitutablePathInfos(paths, caPaths, infos);
logger->stopWork();
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/path-info.hh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct ValidPathInfo : PathReferences<StorePath>

void sign(const Store & store, const SecretKey & secretKey);

std::optional<StorePathDescriptor> fullContentAddressOpt() const;
std::optional<StorePathDescriptor> fullStorePathDescriptorOpt() const;

/* Return true iff the path is verifiably content-addressed. */
bool isContentAddressed(const Store & store) const;
Expand Down
6 changes: 3 additions & 3 deletions src/libstore/remote-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void writeStorePaths(const Store & store, Sink & out, const StorePathSet & paths
out << store.printStorePath(i);
}

std::set<StorePathDescriptor> readContentAddressSet(const Store & store, Source & from)
std::set<StorePathDescriptor> readStorePathDescriptorSet(const Store & store, Source & from)
{
std::set<StorePathDescriptor> paths;
// TODO
Expand All @@ -49,7 +49,7 @@ std::set<StorePathDescriptor> readContentAddressSet(const Store & store, Source
return paths;
}

void writeContentAddressSet(const Store & store, Sink & out, const std::set<StorePathDescriptor> & paths)
void writeStorePathDescriptorSet(const Store & store, Sink & out, const std::set<StorePathDescriptor> & paths)
{
// TODO
//out << paths.size();
Expand Down Expand Up @@ -388,7 +388,7 @@ void RemoteStore::querySubstitutablePathInfos(const StorePathSet & paths, const
writeStorePaths(*this, conn->to, combine());
} else {
writeStorePaths(*this, conn->to, paths);
writeContentAddressSet(*this, conn->to, caPaths);
writeStorePathDescriptorSet(*this, conn->to, caPaths);
}
conn.processStderr();
size_t count = readNum<size_t>(conn->from);
Expand Down
10 changes: 5 additions & 5 deletions src/libstore/store-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
// recompute store path on the chance dstStore does it differently
if (info->ca && info->references.empty()) {
auto info2 = make_ref<ValidPathInfo>(*info);
info2->path = dstStore->makeFixedOutputPathFromCA(*info->fullContentAddressOpt());
info2->path = dstStore->makeFixedOutputPathFromCA(*info->fullStorePathDescriptorOpt());
if (dstStore->storeDir == srcStore->storeDir)
assert(info->path == info2->path);
info = info2;
Expand Down Expand Up @@ -697,7 +697,7 @@ std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStor
auto info = srcStore->queryPathInfo(storePath);
auto storePathForDst = storePath;
if (info->ca && info->references.empty() && !info->hasSelfReference) {
storePathForDst = dstStore->makeFixedOutputPathFromCA(*info->fullContentAddressOpt());
storePathForDst = dstStore->makeFixedOutputPathFromCA(*info->fullStorePathDescriptorOpt());
if (dstStore->storeDir == srcStore->storeDir)
assert(storePathForDst == storePath);
if (storePathForDst != storePath)
Expand Down Expand Up @@ -725,7 +725,7 @@ std::map<StorePath, StorePath> copyPaths(ref<Store> srcStore, ref<Store> dstStor

auto storePathForDst = storePath;
if (info->ca && info->references.empty() && !info->hasSelfReference) {
storePathForDst = dstStore->makeFixedOutputPathFromCA(*info->fullContentAddressOpt());
storePathForDst = dstStore->makeFixedOutputPathFromCA(*info->fullStorePathDescriptorOpt());
if (dstStore->storeDir == srcStore->storeDir)
assert(storePathForDst == storePath);
if (storePathForDst != storePath)
Expand Down Expand Up @@ -843,7 +843,7 @@ void ValidPathInfo::sign(const Store & store, const SecretKey & secretKey)
sigs.insert(secretKey.signDetached(fingerprint(store)));
}

std::optional<StorePathDescriptor> ValidPathInfo::fullContentAddressOpt() const
std::optional<StorePathDescriptor> ValidPathInfo::fullStorePathDescriptorOpt() const
{
if (! ca)
return std::nullopt;
Expand All @@ -868,7 +868,7 @@ std::optional<StorePathDescriptor> ValidPathInfo::fullContentAddressOpt() const

bool ValidPathInfo::isContentAddressed(const Store & store) const
{
auto fullCaOpt = fullContentAddressOpt();
auto fullCaOpt = fullStorePathDescriptorOpt();

if (! fullCaOpt)
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/libstore/worker-protocol.hh
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ template<class T> T readStorePaths(const Store & store, Source & from);

void writeStorePaths(const Store & store, Sink & out, const StorePathSet & paths);

std::set<StorePathDescriptor> readContentAddressSet(const Store & store, Source & from);
std::set<StorePathDescriptor> readStorePathDescriptorSet(const Store & store, Source & from);

void writeContentAddressSet(const Store & store, Sink & out, const std::set<StorePathDescriptor> & paths);
void writeStorePathDescriptorSet(const Store & store, Sink & out, const std::set<StorePathDescriptor> & paths);

void writeOutputPathMap(const Store & store, Sink & out, const OutputPathMap & paths);

Expand Down

0 comments on commit ade0f1a

Please sign in to comment.