Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
remote-store-connection.hh
Go to the documentation of this file.
1#pragma once
3
6#include "lix/libutil/pool.hh"
7
8namespace nix {
9
18{
23
28
34
46 std::optional<TrustedFlag> remoteTrustsUs;
47
54 std::optional<std::string> daemonNixVersion;
55
59 std::chrono::time_point<std::chrono::steady_clock> startTime;
60
73
86
87 virtual ~Connection();
88
89 virtual void closeWrite() = 0;
90
91 std::exception_ptr processStderr(Sink * sink = 0, Source * source = 0, bool flush = true);
92};
93
102{
104 Sync<ThreadPool> & handlerThreads;
105 bool daemonException = false;
106
107 ConnectionHandle(
109 )
110 : handle(std::move(handle))
111 , handlerThreads(handlerThreads)
112 {
113 }
114
115 ConnectionHandle(ConnectionHandle && h)
116 : handle(std::move(h.handle))
117 , handlerThreads(h.handlerThreads)
118 , daemonException(h.daemonException)
119 {
120 h.daemonException = false;
121 }
122
123 ~ConnectionHandle();
124
125 RemoteStore::Connection & operator * () { return *handle; }
126 RemoteStore::Connection * operator -> () { return &*handle; }
127
128 void processStderr(Sink * sink = 0, Source * source = 0, bool flush = true);
129
130 void withFramedSink(std::function<void(Sink & sink)> fun);
131 kj::Promise<Result<void>>
132 withFramedSinkAsync(std::function<kj::Promise<Result<void>>(Sink & sink)> fun);
133
134private:
135 struct FramedSinkHandler
136 {
137 std::exception_ptr ex;
138 std::packaged_task<void()> stderrHandler;
139
140 explicit FramedSinkHandler(ConnectionHandle & conn, ThreadPool & handlerThreads);
141
142 ~FramedSinkHandler() noexcept(false);
143 };
144};
145
146}
Definition pool.hh:114
Definition sync.hh:37
Definition thread-pool.hh:26
Definition serialise.hh:124
Definition serialise.hh:156
Definition remote-store-connection.hh:102
Definition remote-store-connection.hh:18
WorkerProto::Version daemonVersion
Definition remote-store-connection.hh:33
std::optional< TrustedFlag > remoteTrustsUs
Definition remote-store-connection.hh:46
std::chrono::time_point< std::chrono::steady_clock > startTime
Definition remote-store-connection.hh:59
std::optional< std::string > daemonNixVersion
Definition remote-store-connection.hh:54
FdSink to
Definition remote-store-connection.hh:22
FdSource from
Definition remote-store-connection.hh:27
Definition serialise.hh:18
Definition serialise.hh:66
Definition worker-protocol.hh:76
Definition worker-protocol.hh:89
unsigned int Version
Definition worker-protocol.hh:70