Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
uds-remote-store.hh
Go to the documentation of this file.
1#pragma once
3
7
8namespace nix {
9
24std::filesystem::path getDaemonSocketPath(const Store::Config & config);
25
26struct UDSRemoteStoreConfig : std::enable_shared_from_this<UDSRemoteStoreConfig>,
27 virtual LocalFSStoreConfig,
28 virtual RemoteStoreConfig
29{
30private:
31 void anchor() override;
32
33public:
34 UDSRemoteStoreConfig(const std::filesystem::path & path, const Params & params);
35
36 UDSRemoteStoreConfig(const Params & params);
37
38 static const std::string name()
39 {
40 return "Local Daemon Store";
41 }
42
43 static std::string doc();
44
50 std::filesystem::path path;
51
52 static StringSet uriSchemes()
53 {
54 return {"unix"};
55 }
56
57 ref<Store> openStore() const override;
58
59 StoreReference getReference() const override;
60};
61
62struct UDSRemoteStore : virtual IndirectRootStore, virtual RemoteStore
63{
64private:
65 void anchor() override;
66
67public:
68 using Config = UDSRemoteStoreConfig;
69
70 ref<const Config> config;
71
72 UDSRemoteStore(ref<const Config>);
73
74 ref<SourceAccessor> getFSAccessor(bool requireValidPath = true) override
75 {
76 return LocalFSStore::getFSAccessor(requireValidPath);
77 }
78
79 std::shared_ptr<SourceAccessor> getFSAccessor(const StorePath & path, bool requireValidPath = true) override
80 {
81 return LocalFSStore::getFSAccessor(path, requireValidPath);
82 }
83
84 void narFromPath(const StorePath & path, Sink & sink) override
85 {
86 Store::narFromPath(path, sink);
87 }
88
97 void addIndirectRoot(const std::filesystem::path & path) override;
98
99private:
100
101 struct Connection : RemoteStore::Connection
102 {
103 AutoCloseFD fd;
104 void closeWrite() override;
105 };
106
107 ref<RemoteStore::Connection> openConnection() override;
108};
109
110} // namespace nix
Definition file-descriptor.hh:265
Definition path.hh:33
virtual void narFromPath(const StorePath &path, Sink &sink)
Definition store-api.cc:390
Definition ref.hh:58
ref< Store > openStore(StoreReference &&storeURI)
Definition store-registration.cc:24
Definition indirect-root-store.hh:40
ref< SourceAccessor > getFSAccessor(bool requireValidPath=true) override
Definition local-fs-store.cc:178
Definition remote-store-connection.hh:22
Definition serialise.hh:18
Definition uds-remote-store.hh:29
StoreReference getReference() const override
Definition uds-remote-store.cc:66
std::filesystem::path path
Definition uds-remote-store.hh:50
void narFromPath(const StorePath &path, Sink &sink) override
Definition uds-remote-store.hh:84
std::shared_ptr< SourceAccessor > getFSAccessor(const StorePath &path, bool requireValidPath=true) override
Definition uds-remote-store.hh:79
void addIndirectRoot(const std::filesystem::path &path) override
Definition uds-remote-store.cc:106
ref< SourceAccessor > getFSAccessor(bool requireValidPath=true) override
Definition uds-remote-store.hh:74
std::set< std::string, std::less<> > StringSet
Definition types.hh:45
std::filesystem::path getDaemonSocketPath(const Store::Config &config)
Definition uds-remote-store.cc:22