refactor(tvix): Remove UDSRemoteStore
Now that we've fully implemented the RPC-based store client, we can get rid of the UDSRemoteStore, whose only use was connecting to the locally running nix daemon. The RemoteStore still needs to be around to connect to remote upstream nix stores over SSH. Change-Id: I0699819803cbfe966b9a46786f2c927d8e4bf1a2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1693 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
This commit is contained in:
parent
e440f60b6c
commit
059468ba15
2 changed files with 0 additions and 76 deletions
62
third_party/nix/src/libstore/remote-store.cc
vendored
62
third_party/nix/src/libstore/remote-store.cc
vendored
|
@ -69,56 +69,6 @@ ref<RemoteStore::Connection> RemoteStore::openConnectionWrapper() {
|
|||
}
|
||||
}
|
||||
|
||||
UDSRemoteStore::UDSRemoteStore(const Params& params)
|
||||
: Store(params), LocalFSStore(params), RemoteStore(params) {}
|
||||
|
||||
UDSRemoteStore::UDSRemoteStore(std::string socket_path, const Params& params)
|
||||
: Store(params),
|
||||
LocalFSStore(params),
|
||||
RemoteStore(params),
|
||||
path(socket_path) {}
|
||||
|
||||
std::string UDSRemoteStore::getUri() {
|
||||
if (path) {
|
||||
return std::string("unix://") + *path;
|
||||
}
|
||||
return "daemon";
|
||||
}
|
||||
|
||||
ref<RemoteStore::Connection> UDSRemoteStore::openConnection() {
|
||||
auto conn = make_ref<Connection>();
|
||||
|
||||
/* Connect to a daemon that does the privileged work for us. */
|
||||
conn->fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if (!conn->fd) {
|
||||
throw SysError("cannot create Unix domain socket");
|
||||
}
|
||||
closeOnExec(conn->fd.get());
|
||||
|
||||
std::string socketPath = path ? *path : settings.nixDaemonSocketFile;
|
||||
|
||||
struct sockaddr_un addr;
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy(addr.sun_path, socketPath.c_str(), sizeof(addr.sun_path));
|
||||
if (addr.sun_path[sizeof(addr.sun_path) - 1] != '\0') {
|
||||
throw Error(format("socket path '%1%' is too long") % socketPath);
|
||||
}
|
||||
|
||||
if (::connect(conn->fd.get(), reinterpret_cast<struct sockaddr*>(&addr),
|
||||
sizeof(addr)) == -1) {
|
||||
throw SysError(format("cannot connect to daemon at '%1%'") % socketPath);
|
||||
}
|
||||
|
||||
conn->from.fd = conn->fd.get();
|
||||
conn->to.fd = conn->fd.get();
|
||||
|
||||
conn->startTime = std::chrono::steady_clock::now();
|
||||
|
||||
initConnection(*conn);
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
||||
void RemoteStore::initConnection(Connection& conn) {
|
||||
/* Send the magic greeting, check for the reply. */
|
||||
try {
|
||||
|
@ -727,16 +677,4 @@ std::exception_ptr RemoteStore::Connection::processStderr(Sink* sink,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static std::string uriScheme = "unix://";
|
||||
|
||||
static RegisterStoreImplementation regStore(
|
||||
[](const std::string& uri,
|
||||
const Store::Params& params) -> std::shared_ptr<Store> {
|
||||
if (std::string(uri, 0, uriScheme.size()) != uriScheme) {
|
||||
return nullptr;
|
||||
}
|
||||
return std::make_shared<UDSRemoteStore>(
|
||||
std::string(uri, uriScheme.size()), params);
|
||||
});
|
||||
|
||||
} // namespace nix
|
||||
|
|
14
third_party/nix/src/libstore/remote-store.hh
vendored
14
third_party/nix/src/libstore/remote-store.hh
vendored
|
@ -136,18 +136,4 @@ class RemoteStore : public virtual Store {
|
|||
std::atomic_bool failed{false};
|
||||
};
|
||||
|
||||
class UDSRemoteStore : public LocalFSStore, public RemoteStore {
|
||||
public:
|
||||
UDSRemoteStore(const Params& params);
|
||||
UDSRemoteStore(std::string path, const Params& params);
|
||||
|
||||
std::string getUri() override;
|
||||
|
||||
bool sameMachine() override { return true; }
|
||||
|
||||
private:
|
||||
ref<RemoteStore::Connection> openConnection() override;
|
||||
std::optional<std::string> path;
|
||||
};
|
||||
|
||||
} // namespace nix
|
||||
|
|
Loading…
Reference in a new issue