Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
serve-protocol-impl.hh
Go to the documentation of this file.
1#pragma once
10
13
14namespace nix {
15
16/* protocol-agnostic templates */
17
18#define SERVE_USE_LENGTH_PREFIX_SERIALISER(TEMPLATE, T) \
19 TEMPLATE T ServeProto::Serialise<T>::read(const StoreDirConfig & store, ServeProto::ReadConn conn) \
20 { \
21 return LengthPrefixedProtoHelper<ServeProto, T>::read(store, conn); \
22 } \
23 TEMPLATE void ServeProto::Serialise<T>::write( \
24 const StoreDirConfig & store, ServeProto::WriteConn conn, const T & t) \
25 { \
26 LengthPrefixedProtoHelper<ServeProto, T>::write(store, conn, t); \
27 }
28
29SERVE_USE_LENGTH_PREFIX_SERIALISER(template<typename T>, std::vector<T>)
30#define COMMA_ ,
31SERVE_USE_LENGTH_PREFIX_SERIALISER(template<typename T COMMA_ typename Compare>, std::set<T COMMA_ Compare>)
32#undef COMMA_
33SERVE_USE_LENGTH_PREFIX_SERIALISER(template<typename... Ts>, std::tuple<Ts...>)
34
35#define SERVE_USE_LENGTH_PREFIX_SERIALISER_COMMA ,
36SERVE_USE_LENGTH_PREFIX_SERIALISER(
37 template<typename K SERVE_USE_LENGTH_PREFIX_SERIALISER_COMMA typename V SERVE_USE_LENGTH_PREFIX_SERIALISER_COMMA
38 typename Compare>
39 ,
40 std::map<K SERVE_USE_LENGTH_PREFIX_SERIALISER_COMMA V SERVE_USE_LENGTH_PREFIX_SERIALISER_COMMA Compare>)
41
42
45template<typename T>
47{
48 static T read(const StoreDirConfig & store, ServeProto::ReadConn conn)
49 {
50 return CommonProto::Serialise<T>::read(store, CommonProto::ReadConn{.from = conn.from});
51 }
52
53 static void write(const StoreDirConfig & store, ServeProto::WriteConn conn, const T & t)
54 {
56 }
57};
58
59/* protocol-specific templates */
60
61} // namespace nix
Definition common-protocol.hh:36
Definition common-protocol.hh:50
Definition common-protocol.hh:45
Definition serve-protocol.hh:80
Definition serve-protocol-impl.hh:47
Definition serve-protocol.hh:90
Definition store-dir-config.hh:29