-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start factoring out the serve protocol for Hydra to share
Hydra uses the lock argument differently than Nix, so we un-hard-code it. The parent commit is chosen such that this should work for 2.6 and master alike.
- Loading branch information
1 parent
df552ff
commit 9977c4b
Showing
3 changed files
with
53 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "serve-protocol-impl.hh" | ||
|
||
#include "remote-store.hh" | ||
|
||
namespace nix { | ||
namespace serve_proto { | ||
|
||
StorePathSet queryValidPaths( | ||
BasicConnection & conn, const Store & remoteStore, | ||
bool lock, const StorePathSet & paths, | ||
SubstituteFlag maybeSubstitute) | ||
{ | ||
conn.to | ||
<< cmdQueryValidPaths | ||
<< lock | ||
<< maybeSubstitute; | ||
worker_proto::write(remoteStore, conn.to, paths); | ||
conn.to.flush(); | ||
|
||
return worker_proto::read(remoteStore, conn.from, Phantom<StorePathSet> {}); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include "serialise.hh" | ||
|
||
#include "store-api.hh" | ||
#include "serve-protocol.hh" | ||
#include "worker-protocol.hh" | ||
|
||
namespace nix { | ||
namespace serve_proto { | ||
|
||
struct BasicConnection | ||
{ | ||
FdSink to; | ||
FdSource from; | ||
int remoteVersion; | ||
}; | ||
|
||
StorePathSet queryValidPaths( | ||
BasicConnection & conn, const Store & remoteStore, | ||
bool lock, const StorePathSet & paths, | ||
SubstituteFlag maybeSubstitute); | ||
|
||
} | ||
} |