Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
worker-protocol.hh File Reference
#include <algorithm>
#include <chrono>
#include <compare>
#include "nix/store/common-protocol.hh"
#include "nix/store/gc-store.hh"

Go to the source code of this file.

Classes

struct  nix::WorkerProto
struct  nix::WorkerProto::Version
struct  nix::WorkerProto::Version::Number
struct  nix::WorkerProto::ReadConn
struct  nix::WorkerProto::WriteConn
struct  nix::WorkerProto::ClientHandshakeInfo
struct  nix::WorkerProto::Serialise< DerivedPath >
struct  nix::WorkerProto::Serialise< SingleDerivedPath >
struct  nix::WorkerProto::Serialise< BuildResult >
struct  nix::WorkerProto::Serialise< KeyedBuildResult >
struct  nix::WorkerProto::Serialise< ValidPathInfo >
struct  nix::WorkerProto::Serialise< UnkeyedValidPathInfo >
struct  nix::WorkerProto::Serialise< DrvOutput >
struct  nix::WorkerProto::Serialise< UnkeyedRealisation >
struct  nix::WorkerProto::Serialise< Realisation >
struct  nix::WorkerProto::Serialise< std::optional< UnkeyedRealisation > >
struct  nix::WorkerProto::Serialise< BuildMode >
struct  nix::WorkerProto::Serialise< GCAction >
struct  nix::WorkerProto::Serialise< std::optional< TrustedFlag > >
struct  nix::WorkerProto::Serialise< std::optional< std::chrono::microseconds > >
struct  nix::WorkerProto::Serialise< WorkerProto::ClientHandshakeInfo >
struct  nix::WorkerProto::Serialise< GCOptions::SpecificPaths >
struct  nix::WorkerProto::Serialise< GCOptions::GCPaths >
struct  nix::WorkerProto::Serialise< std::vector< T > >
struct  nix::WorkerProto::Serialise< std::set< T, Compare > >
struct  nix::WorkerProto::Serialise< std::tuple< Ts... > >
struct  nix::WorkerProto::Serialise< std::map< K, V, Compare > >

Macros

#define WORKER_MAGIC_1   0x6e697863
#define WORKER_MAGIC_2   0x6478696f
#define PROTOCOL_VERSION   (1 << 8 | 39)
#define MINIMUM_PROTOCOL_VERSION   (1 << 8 | 18)
#define GET_PROTOCOL_MAJOR(x)
#define GET_PROTOCOL_MINOR(x)
#define STDERR_NEXT   0x6f6c6d67
#define STDERR_READ   0x64617461
#define STDERR_WRITE   0x64617416
#define STDERR_LAST   0x616c7473
#define STDERR_ERROR   0x63787470
#define STDERR_START_ACTIVITY   0x53545254
#define STDERR_STOP_ACTIVITY   0x53544f50
#define STDERR_RESULT   0x52534c54
#define DECLARE_WORKER_SERIALISER(T)
#define COMMA_   ,

Functions

Sink & nix::operator<< (Sink &sink, WorkerProto::Op op)
std::ostream & nix::operator<< (std::ostream &s, WorkerProto::Op op)

Macro Definition Documentation

◆ DECLARE_WORKER_SERIALISER

#define DECLARE_WORKER_SERIALISER ( T)
Value:
struct WorkerProto::Serialise<T> \
{ \
static T read(const StoreDirConfig & store, WorkerProto::ReadConn conn); \
static void write(const StoreDirConfig & store, WorkerProto::WriteConn conn, const T & t); \
};

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)

◆ GET_PROTOCOL_MINOR

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

Function Documentation

◆ operator<<() [1/2]

Sink & nix::operator<< ( Sink & sink,
WorkerProto::Op op )
inline

Convenience for sending operation codes.

Todo
Switch to using WorkerProto::Serialise 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,
WorkerProto::Op op )
inline

Convenience for debugging.

Todo
Perhaps render known opcodes more nicely.