Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
serve-protocol-impl.hh
Go to the documentation of this file.
1
#pragma once
10
11
#include "
nix/store/serve-protocol.hh
"
12
#include "
nix/store/length-prefixed-protocol-helper.hh
"
13
14
namespace
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
29
SERVE_USE_LENGTH_PREFIX_SERIALISER(template<typename T>, std::vector<T>)
30
#define COMMA_ ,
31
SERVE_USE_LENGTH_PREFIX_SERIALISER(template<typename T COMMA_ typename Compare>, std::set<T COMMA_ Compare>)
32
#undef COMMA_
33
SERVE_USE_LENGTH_PREFIX_SERIALISER(template<typename... Ts>, std::tuple<Ts...>)
34
35
#define SERVE_USE_LENGTH_PREFIX_SERIALISER_COMMA ,
36
SERVE_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
45
template
<
typename
T>
46
struct
ServeProto::Serialise
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
{
55
CommonProto::Serialise<T>::write
(store,
CommonProto::WriteConn
{.to = conn.to}, t);
56
}
57
};
58
59
/* protocol-specific templates */
60
61
}
// namespace nix
length-prefixed-protocol-helper.hh
serve-protocol.hh
nix::CommonProto::ReadConn
Definition
common-protocol.hh:36
nix::CommonProto::Serialise
Definition
common-protocol.hh:50
nix::CommonProto::WriteConn
Definition
common-protocol.hh:45
nix::ServeProto::ReadConn
Definition
serve-protocol.hh:80
nix::ServeProto::Serialise
Definition
serve-protocol-impl.hh:47
nix::ServeProto::WriteConn
Definition
serve-protocol.hh:90
nix::StoreDirConfig
Definition
store-dir-config.hh:29
libstore
include
nix
store
serve-protocol-impl.hh
Generated by
1.18.0