libstore: derive legacy-tunneled rpc id from package version
this way each git revision trivially gets its own rpc protocol version. Change-Id: I066c58ebff697e534479db5d02271dac1ea71709
This commit is contained in:
@@ -28,10 +28,6 @@ interface Protocol {
|
||||
# TODO maybe add information or something
|
||||
}
|
||||
|
||||
# legacy boot protocol. EXPLICITLY UNSTABLE, this id will change frequently and without notice.
|
||||
# every change to the experimental tunneling protocol may also change this protocol identifier.
|
||||
const unstableLegacyTunneled :Text = "lix/legacy/ba3153c5-4153-4d66-91ec-a258c02e9a3c";
|
||||
|
||||
interface LegacyBoot extends(Protocol) $T.throws(T.v1Errors) {
|
||||
enum Trust {
|
||||
unknown @0;
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <kj/memory.h>
|
||||
#include <sstream>
|
||||
|
||||
const std::string nix::rpc::daemon::UNSTABLE_LEGACY_TUNNELED = "lix/legacy/" PACKAGE_VERSION;
|
||||
|
||||
namespace nix::daemon {
|
||||
|
||||
Sink & operator << (Sink & sink, const Logger::Fields & fields)
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
#include "lix/libstore/store-api.hh"
|
||||
#include <kj/async-io.h>
|
||||
|
||||
namespace nix::rpc::daemon {
|
||||
// legacy boot protocol. EXPLICITLY UNSTABLE, this id will change frequently and without notice.
|
||||
// every change to the experimental tunneling protocol may also change this protocol identifier.
|
||||
extern const std::string UNSTABLE_LEGACY_TUNNELED;
|
||||
}
|
||||
|
||||
namespace nix::daemon {
|
||||
|
||||
void processLegacyConnection(
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <exception>
|
||||
#include <kj/async.h>
|
||||
#include <kj/encoding.h>
|
||||
#include <string_view>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -184,7 +185,7 @@ try {
|
||||
auto supportedProtos = supported.getProtocols();
|
||||
debug("remote advertised %s", supported.toString().flatten().cStr());
|
||||
if (supportedProtos.size() != 1
|
||||
&& supportedProtos[0].getId() != rpc::daemon::UNSTABLE_LEGACY_TUNNELED)
|
||||
&& rpc::to<std::string_view>(supportedProtos[0].getId()) != rpc::daemon::UNSTABLE_LEGACY_TUNNELED)
|
||||
{
|
||||
co_return false;
|
||||
}
|
||||
@@ -201,7 +202,7 @@ try {
|
||||
|
||||
auto bootstrapReq = bootstrap.requestRequest();
|
||||
bootstrapReq.setClientInfo(PACKAGE_STRING);
|
||||
bootstrapReq.setProtocol(rpc::daemon::UNSTABLE_LEGACY_TUNNELED);
|
||||
RPC_FILL(bootstrapReq, setProtocol, rpc::daemon::UNSTABLE_LEGACY_TUNNELED);
|
||||
auto legacyBoot =
|
||||
TRY_AWAIT_RPC_NOEXCEPT(bootstrapReq.send()).getResult().castAs<rpc::daemon::LegacyBoot>();
|
||||
auto initReq = legacyBoot.initRequest();
|
||||
|
||||
Reference in New Issue
Block a user