Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
serve-protocol.hh File Reference
#include "common-protocol.hh"

Go to the source code of this file.

Classes

struct  nix::ServeProto
 
struct  nix::ServeProto::ReadConn
 
struct  nix::ServeProto::WriteConn
 
struct  nix::ServeProto::BuildOptions
 
struct  nix::ServeProto::Serialise< BuildResult >
 
struct  nix::ServeProto::Serialise< UnkeyedValidPathInfo >
 
struct  nix::ServeProto::Serialise< ServeProto::BuildOptions >
 
struct  nix::ServeProto::Serialise< std::vector< T > >
 
struct  nix::ServeProto::Serialise< std::set< T > >
 
struct  nix::ServeProto::Serialise< std::tuple< Ts... > >
 
struct  nix::ServeProto::Serialise< std::map< K COMMA_ V > >
 

Macros

#define SERVE_MAGIC_1   0x390c9deb
 
#define SERVE_MAGIC_2   0x5452eecb
 
#define SERVE_PROTOCOL_VERSION   (2 << 8 | 7)
 
#define GET_PROTOCOL_MAJOR(x)
 
#define GET_PROTOCOL_MINOR(x)
 
#define DECLARE_SERVE_SERIALISER(T)
 
#define COMMA_   ,
 

Functions

Sinknix::operator<< (Sink &sink, ServeProto::Command op)
 
std::ostream & nix::operator<< (std::ostream &s, ServeProto::Command op)
 

Macro Definition Documentation

◆ DECLARE_SERVE_SERIALISER

#define DECLARE_SERVE_SERIALISER ( T)
Value:
struct ServeProto::Serialise< T > \
{ \
static T read(const StoreDirConfig & store, ServeProto::ReadConn conn); \
static void write(const StoreDirConfig & store, ServeProto::WriteConn conn, const T & t); \
};
ChunkedVector< std::string, 8192 > store
Definition lexer.l:1011
T t
Definition lexer.l:154

Declare a canonical serialiser pair for the worker protocol.

We specialise the struct merely to indicate that we are implementing the function for the given type.

Some sort of template<...> must be used with the caller for this to be legal specialization syntax. See below for what that looks like in practice.

◆ GET_PROTOCOL_MAJOR

#define GET_PROTOCOL_MAJOR ( x)
Value:
((x) & 0xff00)
T x
Definition lexer.l:2648

◆ GET_PROTOCOL_MINOR

#define GET_PROTOCOL_MINOR ( x)
Value:
((x) & 0x00ff)

Function Documentation

◆ operator<<() [1/2]

Sink & nix::operator<< ( Sink & sink,
ServeProto::Command op )
inline

Convenience for sending operation codes.

Todo
Switch to using ServeProto::Serialize instead probably. But this was not done at this time so there would be less churn.

◆ operator<<() [2/2]

std::ostream & nix::operator<< ( std::ostream & s,
ServeProto::Command op )
inline

Convenience for debugging.

Todo
Perhaps render known opcodes more nicely.