2020-10-11 17:18:26 +00:00
|
|
|
#pragma once
|
2023-04-01 03:18:41 +00:00
|
|
|
///@file
|
2020-10-11 17:18:26 +00:00
|
|
|
|
2020-10-11 16:01:53 +00:00
|
|
|
#include "remote-store.hh"
|
2023-04-17 17:40:46 +00:00
|
|
|
#include "remote-store-connection.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"; }
|
2023-03-21 13:03:05 +00:00
|
|
|
|
2023-06-12 09:10:55 +00:00
|
|
|
std::string doc() override;
|
2020-10-11 17:18:26 +00:00
|
|
|
};
|
|
|
|
|
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"}; }
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|