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"
|
2023-03-23 14:06:45 +00:00
|
|
|
#include "indirect-root-store.hh"
|
2020-10-11 17:18:26 +00:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
struct UDSRemoteStoreConfig : virtual LocalFSStoreConfig, virtual RemoteStoreConfig
|
|
|
|
{
|
2023-04-17 16:17:35 +00:00
|
|
|
UDSRemoteStoreConfig(const Params & params)
|
2020-10-11 17:18:26 +00:00
|
|
|
: 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
|
|
|
};
|
|
|
|
|
2023-03-23 14:06:45 +00:00
|
|
|
class UDSRemoteStore : public virtual UDSRemoteStoreConfig
|
|
|
|
, public virtual IndirectRootStore
|
|
|
|
, 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); }
|
|
|
|
|
2023-03-23 14:06:45 +00:00
|
|
|
/**
|
|
|
|
* Implementation of `IndirectRootStore::addIndirectRoot()` which
|
|
|
|
* delegates to the remote store.
|
|
|
|
*
|
|
|
|
* The idea is that the client makes the direct symlink, so it is
|
|
|
|
* owned managed by the client's user account, and the server makes
|
|
|
|
* the indirect symlink.
|
|
|
|
*/
|
|
|
|
void addIndirectRoot(const Path & path) override;
|
|
|
|
|
2020-10-11 17:18:26 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|