Change parseCa(Opt) to parseContentAddress(Opt)

This commit is contained in:
Carlo Nucera 2020-06-02 11:00:10 -04:00
parent 1b6461f671
commit a5d820a0a3
9 changed files with 12 additions and 12 deletions

View file

@ -711,7 +711,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
{ {
string caOptRaw; string caOptRaw;
from >> caOptRaw; from >> caOptRaw;
info.ca = parseCaOpt(caOptRaw); info.ca = parseContentAddressOpt(caOptRaw);
} }
from >> repair >> dontCheckSigs; from >> repair >> dontCheckSigs;
if (!trusted && dontCheckSigs) if (!trusted && dontCheckSigs)

View file

@ -38,12 +38,12 @@ std::string renderContentAddress(ContentAddress ca) {
}, ca); }, ca);
} }
ContentAddress parseCa(std::string_view rawCa) { ContentAddress parseContentAddress(std::string_view rawCa) {
throw Error("TODO"); throw Error("TODO");
}; };
std::optional<ContentAddress> parseCaOpt(std::string_view rawCaOpt) { std::optional<ContentAddress> parseContentAddressOpt(std::string_view rawCaOpt) {
return rawCaOpt == "" ? std::optional<ContentAddress> {} : parseCa(rawCaOpt); return rawCaOpt == "" ? std::optional<ContentAddress> {} : parseContentAddress(rawCaOpt);
}; };
std::string renderContentAddress(std::optional<ContentAddress> ca) { std::string renderContentAddress(std::optional<ContentAddress> ca) {

View file

@ -59,8 +59,8 @@ std::string renderContentAddress(ContentAddress ca);
std::string renderContentAddress(std::optional<ContentAddress> ca); std::string renderContentAddress(std::optional<ContentAddress> ca);
ContentAddress parseCa(std::string_view rawCa); ContentAddress parseContentAddress(std::string_view rawCa);
std::optional<ContentAddress> parseCaOpt(std::string_view rawCaOpt); std::optional<ContentAddress> parseContentAddressOpt(std::string_view rawCaOpt);
} }

View file

@ -117,7 +117,7 @@ struct LegacySSHStore : public Store
{ {
std::string rawCaOpt; std::string rawCaOpt;
conn->from >> rawCaOpt; conn->from >> rawCaOpt;
info->ca = parseCaOpt(rawCaOpt); info->ca = parseContentAddressOpt(rawCaOpt);
} }
info->sigs = readStrings<StringSet>(conn->from); info->sigs = readStrings<StringSet>(conn->from);
} }

View file

@ -662,7 +662,7 @@ void LocalStore::queryPathInfoUncached(const StorePath & path,
if (s) info->sigs = tokenizeString<StringSet>(s, " "); if (s) info->sigs = tokenizeString<StringSet>(s, " ");
s = (const char *) sqlite3_column_text(state->stmtQueryPathInfo, 7); s = (const char *) sqlite3_column_text(state->stmtQueryPathInfo, 7);
if (s) info->ca = parseCaOpt(s); if (s) info->ca = parseContentAddressOpt(s);
/* Get the references. */ /* Get the references. */
auto useQueryReferences(state->stmtQueryReferences.use()(info->id)); auto useQueryReferences(state->stmtQueryReferences.use()(info->id));

View file

@ -203,7 +203,7 @@ public:
narInfo->deriver = StorePath::fromBaseName(queryNAR.getStr(9)); narInfo->deriver = StorePath::fromBaseName(queryNAR.getStr(9));
for (auto & sig : tokenizeString<Strings>(queryNAR.getStr(10), " ")) for (auto & sig : tokenizeString<Strings>(queryNAR.getStr(10), " "))
narInfo->sigs.insert(sig); narInfo->sigs.insert(sig);
narInfo->ca = parseCaOpt(queryNAR.getStr(11)); narInfo->ca = parseContentAddressOpt(queryNAR.getStr(11));
return {oValid, narInfo}; return {oValid, narInfo};
}); });

View file

@ -69,7 +69,7 @@ NarInfo::NarInfo(const Store & store, const std::string & s, const std::string &
else if (name == "CA") { else if (name == "CA") {
if (ca) corrupt(); if (ca) corrupt();
// FIXME: allow blank ca or require skipping field? // FIXME: allow blank ca or require skipping field?
ca = parseCaOpt(value); ca = parseContentAddressOpt(value);
} }
pos = eol + 1; pos = eol + 1;

View file

@ -383,7 +383,7 @@ void RemoteStore::queryPathInfoUncached(const StorePath & path,
info->sigs = readStrings<StringSet>(conn->from); info->sigs = readStrings<StringSet>(conn->from);
string caOptRaw; string caOptRaw;
conn->from >> caOptRaw; conn->from >> caOptRaw;
info->ca = parseCaOpt(caOptRaw); info->ca = parseContentAddressOpt(caOptRaw);
} }
} }
callback(std::move(info)); callback(std::move(info));

View file

@ -947,7 +947,7 @@ static void opServe(Strings opFlags, Strings opArgs)
{ {
std::string rawCA; std::string rawCA;
in >> rawCA; in >> rawCA;
info.ca = parseCaOpt(rawCA); info.ca = parseContentAddressOpt(rawCA);
} }
if (info.narSize == 0) if (info.narSize == 0)