2020-10-11 17:18:26 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-10-11 16:01:53 +00:00
|
|
|
#include "remote-store.hh"
|
2020-10-11 17:18:26 +00:00
|
|
|
#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"; }
|
|
|
|
};
|
|
|
|
|
2020-12-20 15:33:12 +00:00
|
|
|
class UDSRemoteStore : public virtual UDSRemoteStoreConfig, public virtual LocalFSStore, public virtual RemoteStore
|
2020-10-11 17:18:26 +00:00
|
|
|
{
|
|
|
|
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:
|
|
|
|
|
2021-09-23 16:01:04 +00:00
|
|
|
struct Connection : RemoteStore::Connection
|
|
|
|
{
|
|
|
|
AutoCloseFD fd;
|
|
|
|
void closeWrite() override;
|
|
|
|
};
|
|
|
|
|
2020-10-11 17:18:26 +00:00
|
|
|
ref<RemoteStore::Connection> openConnection() override;
|
|
|
|
std::optional<std::string> path;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|