feat(nix-daemon): Implement client handler.

This change includes only the basic nix handshake protocol handling and
sets up a client session. The only supported operation at this point is
SetOptions.

Additional operations will be implemented in subsequent cls.

Change-Id: I3eccd9e0ceb270c3865929543c702f1491768852
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12743
Autosubmit: Vladimir Kryachko <v.kryachko@gmail.com>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: Brian Olsen <me@griff.name>
This commit is contained in:
Vova Kryachko 2024-11-08 10:44:27 -05:00 committed by Vladimir Kryachko
parent 72bc4e0270
commit b564ed9d43
25 changed files with 1822 additions and 253 deletions

View file

@ -8,10 +8,13 @@ edition = "2021"
async = ["tokio"]
# code emitting low-level packets used in the daemon protocol.
wire = ["tokio", "pin-project-lite", "bytes"]
# nix-daemon protocol handling
daemon = ["tokio", "nix-compat-derive"]
test = []
# Enable all features by default.
default = ["async", "wire", "nix-compat-derive"]
default = ["async", "daemon", "wire", "nix-compat-derive"]
[dependencies]
bitflags = { workspace = true }
@ -30,8 +33,9 @@ sha2 = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
bytes = { workspace = true, optional = true }
tokio = { workspace = true, features = ["io-util", "macros"], optional = true }
tokio = { workspace = true, features = ["io-util", "macros", "sync"], optional = true }
pin-project-lite = { workspace = true, optional = true }
num_enum = "0.7.3"
[dependencies.nix-compat-derive]
path = "../nix-compat-derive"