about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-08-08T20·47-0400
committerglittershark <grfn@gws.fyi>2020-08-09T02·22+0000
commit059468ba154fbf6652c89ffe8052c9c8571f6c3e (patch)
tree5f616ccd7f0ab6acdfb1c23f7d9d7305d31a0b78 /third_party
parente440f60b6c74c6e2f406b4f187e6c20ee6d315dd (diff)
refactor(tvix): Remove UDSRemoteStore r/1623
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>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/nix/src/libstore/remote-store.cc62
-rw-r--r--third_party/nix/src/libstore/remote-store.hh14
2 files changed, 0 insertions, 76 deletions
diff --git a/third_party/nix/src/libstore/remote-store.cc b/third_party/nix/src/libstore/remote-store.cc
index 784a95d2e9f2..41881f8ef95d 100644
--- a/third_party/nix/src/libstore/remote-store.cc
+++ b/third_party/nix/src/libstore/remote-store.cc
@@ -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
diff --git a/third_party/nix/src/libstore/remote-store.hh b/third_party/nix/src/libstore/remote-store.hh
index 927d0833541f..a6829226ca87 100644
--- a/third_party/nix/src/libstore/remote-store.hh
+++ b/third_party/nix/src/libstore/remote-store.hh
@@ -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