mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-13 09:46:16 +02:00
ea9df6fe51
This is important if the remote side *does* execute nix-store/nix-daemon successfully, but stdout is polluted (e.g. because the remote user's bashrc script prints something to stdout). In that case we have to shutdown the write side to force the remote nix process to exit.
53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "remote-store.hh"
|
|
#include "local-fs-store.hh"
|
|
|
|
namespace nix {
|
|
|
|
struct UDSRemoteStoreConfig : virtual LocalFSStoreConfig, virtual RemoteStoreConfig
|
|
{
|
|
UDSRemoteStoreConfig(const Store::Params & params)
|
|
: StoreConfig(params)
|
|
, LocalFSStoreConfig(params)
|
|
, RemoteStoreConfig(params)
|
|
{
|
|
}
|
|
|
|
const std::string name() override { return "Local Daemon Store"; }
|
|
};
|
|
|
|
class UDSRemoteStore : public virtual UDSRemoteStoreConfig, public virtual LocalFSStore, public virtual RemoteStore
|
|
{
|
|
public:
|
|
|
|
UDSRemoteStore(const Params & params);
|
|
UDSRemoteStore(const std::string scheme, std::string path, const Params & params);
|
|
|
|
std::string getUri() override;
|
|
|
|
static std::set<std::string> uriSchemes()
|
|
{ return {"unix"}; }
|
|
|
|
bool sameMachine() override
|
|
{ return true; }
|
|
|
|
ref<FSAccessor> getFSAccessor() override
|
|
{ return LocalFSStore::getFSAccessor(); }
|
|
|
|
void narFromPath(const StorePath & path, Sink & sink) override
|
|
{ LocalFSStore::narFromPath(path, sink); }
|
|
|
|
private:
|
|
|
|
struct Connection : RemoteStore::Connection
|
|
{
|
|
AutoCloseFD fd;
|
|
void closeWrite() override;
|
|
};
|
|
|
|
ref<RemoteStore::Connection> openConnection() override;
|
|
std::optional<std::string> path;
|
|
};
|
|
|
|
}
|