2020-10-11 20:18:26 +03:00
|
|
|
#pragma once
|
2023-04-01 06:18:41 +03:00
|
|
|
///@file
|
2020-10-11 20:18:26 +03:00
|
|
|
|
2020-10-11 19:01:53 +03:00
|
|
|
#include "remote-store.hh"
|
2023-04-17 20:40:46 +03:00
|
|
|
#include "remote-store-connection.hh"
|
2023-03-23 16:06:45 +02:00
|
|
|
#include "indirect-root-store.hh"
|
2020-10-11 20:18:26 +03:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
struct UDSRemoteStoreConfig : virtual LocalFSStoreConfig, virtual RemoteStoreConfig
|
|
|
|
{
|
2023-04-17 19:17:35 +03:00
|
|
|
UDSRemoteStoreConfig(const Params & params)
|
2020-10-11 20:18:26 +03:00
|
|
|
: StoreConfig(params)
|
|
|
|
, LocalFSStoreConfig(params)
|
|
|
|
, RemoteStoreConfig(params)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::string name() override { return "Local Daemon Store"; }
|
2023-03-21 15:03:05 +02:00
|
|
|
|
2023-06-12 12:10:55 +03:00
|
|
|
std::string doc() override;
|
2020-10-11 20:18:26 +03:00
|
|
|
};
|
|
|
|
|
2023-03-23 16:06:45 +02:00
|
|
|
class UDSRemoteStore : public virtual UDSRemoteStoreConfig
|
|
|
|
, public virtual IndirectRootStore
|
|
|
|
, public virtual RemoteStore
|
2020-10-11 20:18:26 +03: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"}; }
|
|
|
|
|
2023-09-04 16:51:23 +03:00
|
|
|
ref<SourceAccessor> getFSAccessor(bool requireValidPath = true) override
|
2023-11-01 18:09:28 +02:00
|
|
|
{ return LocalFSStore::getFSAccessor(requireValidPath); }
|
2020-10-11 20:18:26 +03:00
|
|
|
|
|
|
|
void narFromPath(const StorePath & path, Sink & sink) override
|
|
|
|
{ LocalFSStore::narFromPath(path, sink); }
|
|
|
|
|
2023-03-23 16:06:45 +02: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 20:18:26 +03:00
|
|
|
private:
|
|
|
|
|
2021-09-23 19:01:04 +03:00
|
|
|
struct Connection : RemoteStore::Connection
|
|
|
|
{
|
|
|
|
AutoCloseFD fd;
|
|
|
|
void closeWrite() override;
|
|
|
|
};
|
|
|
|
|
2020-10-11 20:18:26 +03:00
|
|
|
ref<RemoteStore::Connection> openConnection() override;
|
|
|
|
std::optional<std::string> path;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|