aboutsummaryrefslogtreecommitdiff
path: root/src/nix-store
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 04:35:39 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 04:37:05 +0100
commite12e9f2452681a3036884e9e778154b35246d39e (patch)
tree57aaea8bf74c53e28fba9598cea034e9b08ce9f5 /src/nix-store
parentaeb803de9ad3cd449f7dc85588430ed5b21503eb (diff)
Merge pull request #9137 from obsidiansystems/serve-protocol
Introduce separate Serve protocol serialisers (cherry picked from commit d070d8b7460f412a657745698dba291c66792402) Change-Id: Ibcc8639e8997bcd07f7a5318330a147bcadc411b
Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/nix-store.cc25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 6fc22214a..9b6c80a75 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -9,10 +9,9 @@
#include "local-store.hh"
#include "monitor-fd.hh"
#include "serve-protocol.hh"
+#include "serve-protocol-impl.hh"
#include "shared.hh"
#include "util.hh"
-#include "common-protocol.hh"
-#include "common-protocol-impl.hh"
#include "graphml.hh"
#include "legacy.hh"
#include "path-with-outputs.hh"
@@ -821,8 +820,8 @@ static void opServe(Strings opFlags, Strings opArgs)
out.flush();
unsigned int clientVersion = readInt(in);
- CommonProto::ReadConn rconn { .from = in };
- CommonProto::WriteConn wconn { .to = out };
+ ServeProto::ReadConn rconn { .from = in };
+ ServeProto::WriteConn wconn { .to = out };
auto getBuildSettings = [&]() {
// FIXME: changing options here doesn't work if we're
@@ -867,7 +866,7 @@ static void opServe(Strings opFlags, Strings opArgs)
case ServeProto::Command::QueryValidPaths: {
bool lock = readInt(in);
bool substitute = readInt(in);
- auto paths = CommonProto::Serialise<StorePathSet>::read(*store, rconn);
+ auto paths = ServeProto::Serialise<StorePathSet>::read(*store, rconn);
if (lock && writeAllowed)
for (auto & path : paths)
store->addTempRoot(path);
@@ -876,19 +875,19 @@ static void opServe(Strings opFlags, Strings opArgs)
store->substitutePaths(paths);
}
- CommonProto::write(*store, wconn, store->queryValidPaths(paths));
+ ServeProto::write(*store, wconn, store->queryValidPaths(paths));
break;
}
case ServeProto::Command::QueryPathInfos: {
- auto paths = CommonProto::Serialise<StorePathSet>::read(*store, rconn);
+ auto paths = ServeProto::Serialise<StorePathSet>::read(*store, rconn);
// !!! Maybe we want a queryPathInfos?
for (auto & i : paths) {
try {
auto info = store->queryPathInfo(i);
out << store->printStorePath(info->path)
<< (info->deriver ? store->printStorePath(*info->deriver) : "");
- CommonProto::write(*store, wconn, info->references);
+ ServeProto::write(*store, wconn, info->references);
// !!! Maybe we want compression?
out << info->narSize // downloadSize
<< info->narSize;
@@ -916,7 +915,7 @@ static void opServe(Strings opFlags, Strings opArgs)
case ServeProto::Command::ExportPaths: {
readInt(in); // obsolete
- store->exportPaths(CommonProto::Serialise<StorePathSet>::read(*store, rconn), out);
+ store->exportPaths(ServeProto::Serialise<StorePathSet>::read(*store, rconn), out);
break;
}
@@ -962,7 +961,7 @@ static void opServe(Strings opFlags, Strings opArgs)
DrvOutputs builtOutputs;
for (auto & [output, realisation] : status.builtOutputs)
builtOutputs.insert_or_assign(realisation.id, realisation);
- CommonProto::write(*store, wconn, builtOutputs);
+ ServeProto::write(*store, wconn, builtOutputs);
}
break;
@@ -971,9 +970,9 @@ static void opServe(Strings opFlags, Strings opArgs)
case ServeProto::Command::QueryClosure: {
bool includeOutputs = readInt(in);
StorePathSet closure;
- store->computeFSClosure(CommonProto::Serialise<StorePathSet>::read(*store, rconn),
+ store->computeFSClosure(ServeProto::Serialise<StorePathSet>::read(*store, rconn),
closure, false, includeOutputs);
- CommonProto::write(*store, wconn, closure);
+ ServeProto::write(*store, wconn, closure);
break;
}
@@ -988,7 +987,7 @@ static void opServe(Strings opFlags, Strings opArgs)
};
if (deriver != "")
info.deriver = store->parseStorePath(deriver);
- info.references = CommonProto::Serialise<StorePathSet>::read(*store, rconn);
+ info.references = ServeProto::Serialise<StorePathSet>::read(*store, rconn);
in >> info.registrationTime >> info.narSize >> info.ultimate;
info.sigs = readStrings<StringSet>(in);
info.ca = ContentAddress::parseOpt(readString(in));