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

@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.8.6"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
"cfg-if",
"getrandom",
@ -696,15 +696,21 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "hashbrown"
version = "0.14.2"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash",
"allocator-api2",
"rayon",
]
[[package]]
name = "hashbrown"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
[[package]]
name = "heck"
version = "0.4.1"
@ -751,12 +757,12 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.1.0"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
dependencies = [
"equivalent",
"hashbrown",
"hashbrown 0.15.1",
]
[[package]]
@ -944,6 +950,7 @@ name = "narinfo2parquet"
version = "0.1.0"
dependencies = [
"anyhow",
"hashbrown 0.14.5",
"jemallocator",
"nix-compat",
"polars",
@ -967,6 +974,7 @@ dependencies = [
"nix-compat-derive",
"nom",
"num-traits",
"num_enum",
"pin-project-lite",
"serde",
"serde_json",
@ -1023,6 +1031,27 @@ dependencies = [
"libm",
]
[[package]]
name = "num_enum"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179"
dependencies = [
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.79",
]
[[package]]
name = "object"
version = "0.32.1"
@ -1124,7 +1153,7 @@ dependencies = [
"foreign_vec",
"futures",
"getrandom",
"hashbrown",
"hashbrown 0.14.5",
"itoa",
"lz4",
"multiversion",
@ -1163,7 +1192,7 @@ dependencies = [
"bytemuck",
"chrono",
"either",
"hashbrown",
"hashbrown 0.14.5",
"indexmap",
"num-traits",
"once_cell",
@ -1255,7 +1284,7 @@ dependencies = [
"argminmax",
"bytemuck",
"either",
"hashbrown",
"hashbrown 0.14.5",
"indexmap",
"memchr",
"num-traits",
@ -1305,7 +1334,7 @@ dependencies = [
"crossbeam-channel",
"crossbeam-queue",
"enum_dispatch",
"hashbrown",
"hashbrown 0.14.5",
"num-traits",
"polars-arrow",
"polars-compute",
@ -1399,7 +1428,7 @@ checksum = "b174ca4a77ad47d7b91a0460aaae65bbf874c8bfbaaa5308675dadef3976bbda"
dependencies = [
"ahash",
"bytemuck",
"hashbrown",
"hashbrown 0.14.5",
"indexmap",
"num-traits",
"once_cell",
@ -1416,6 +1445,15 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro-crate"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b"
dependencies = [
"toml_edit",
]
[[package]]
name = "proc-macro2"
version = "1.0.87"
@ -1874,6 +1912,23 @@ dependencies = [
"tokio",
]
[[package]]
name = "toml_datetime"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
[[package]]
name = "toml_edit"
version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
"indexmap",
"toml_datetime",
"winnow",
]
[[package]]
name = "tracing"
version = "0.1.40"
@ -2165,6 +2220,15 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "winnow"
version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
dependencies = [
"memchr",
]
[[package]]
name = "xxhash-rust"
version = "0.8.7"

View file

@ -129,9 +129,9 @@ rec {
};
"ahash" = rec {
crateName = "ahash";
version = "0.8.6";
version = "0.8.11";
edition = "2018";
sha256 = "0yn9i8nc6mmv28ig9w3dga571q09vg9f1f650mi5z8phx42r6hli";
sha256 = "04chdfkls5xmhp1d48gnjsmglbqibizs3bpbj6rsj604m10si7g8";
authors = [
"Tom Kaitchuck <Tom.Kaitchuck@gmail.com>"
];
@ -150,7 +150,7 @@ rec {
packageId = "once_cell";
usesDefaultFeatures = false;
target = { target, features }: (!(("arm" == target."arch" or null) && ("none" == target."os" or null)));
features = [ "unstable" "alloc" ];
features = [ "alloc" ];
}
{
name = "zerocopy";
@ -2062,11 +2062,11 @@ rec {
];
};
"hashbrown" = rec {
"hashbrown 0.14.5" = rec {
crateName = "hashbrown";
version = "0.14.2";
version = "0.14.5";
edition = "2021";
sha256 = "0mj1x1d16acxf4zg7wr7q2x8pgzfi1bzpifygcsxmg4d2n972gpr";
sha256 = "1wa1vy1xs3mp11bn3z9dv0jricgr6a2j0zkf1g19yz3vw4il89z5";
authors = [
"Amanieu d'Antras <amanieu@gmail.com>"
];
@ -2112,6 +2112,28 @@ rec {
};
resolvedDefaultFeatures = [ "ahash" "allocator-api2" "default" "inline-more" "raw" "rayon" ];
};
"hashbrown 0.15.1" = rec {
crateName = "hashbrown";
version = "0.15.1";
edition = "2021";
sha256 = "1czsvasi3azv2079fcvbhvpisa16w6fi1mfk8zm2c5wbyqdgr6rs";
authors = [
"Amanieu d'Antras <amanieu@gmail.com>"
];
features = {
"alloc" = [ "dep:alloc" ];
"allocator-api2" = [ "dep:allocator-api2" ];
"compiler_builtins" = [ "dep:compiler_builtins" ];
"core" = [ "dep:core" ];
"default" = [ "default-hasher" "inline-more" "allocator-api2" "equivalent" "raw-entry" ];
"default-hasher" = [ "dep:foldhash" ];
"equivalent" = [ "dep:equivalent" ];
"nightly" = [ "allocator-api2?/nightly" "bumpalo/allocator_api" ];
"rayon" = [ "dep:rayon" ];
"rustc-dep-of-std" = [ "nightly" "core" "compiler_builtins" "alloc" "rustc-internal-api" "raw-entry" ];
"serde" = [ "dep:serde" ];
};
};
"heck" = rec {
crateName = "heck";
version = "0.4.1";
@ -2226,9 +2248,9 @@ rec {
};
"indexmap" = rec {
crateName = "indexmap";
version = "2.1.0";
version = "2.6.0";
edition = "2021";
sha256 = "07rxrqmryr1xfnmhrjlz8ic6jw28v6h5cig3ws2c9d0wifhy2c6m";
sha256 = "1nmrwn8lbs19gkvhxaawffzbvrpyrb5y3drcrr645x957kz0fybh";
dependencies = [
{
name = "equivalent";
@ -2237,13 +2259,13 @@ rec {
}
{
name = "hashbrown";
packageId = "hashbrown";
packageId = "hashbrown 0.15.1";
usesDefaultFeatures = false;
features = [ "raw" ];
}
];
features = {
"arbitrary" = [ "dep:arbitrary" ];
"borsh" = [ "dep:borsh" ];
"default" = [ "std" ];
"quickcheck" = [ "dep:quickcheck" ];
"rayon" = [ "dep:rayon" ];
@ -2756,6 +2778,11 @@ rec {
packageId = "anyhow";
features = [ "backtrace" ];
}
{
name = "hashbrown";
packageId = "hashbrown 0.14.5";
features = [ "raw" ];
}
{
name = "jemallocator";
packageId = "jemallocator";
@ -2840,6 +2867,10 @@ rec {
name = "num-traits";
packageId = "num-traits";
}
{
name = "num_enum";
packageId = "num_enum";
}
{
name = "pin-project-lite";
packageId = "pin-project-lite";
@ -2866,7 +2897,7 @@ rec {
name = "tokio";
packageId = "tokio";
optional = true;
features = [ "io-util" "macros" ];
features = [ "io-util" "macros" "sync" ];
}
{
name = "tracing";
@ -2886,13 +2917,14 @@ rec {
features = {
"async" = [ "tokio" ];
"bytes" = [ "dep:bytes" ];
"default" = [ "async" "wire" "nix-compat-derive" ];
"daemon" = [ "tokio" "nix-compat-derive" ];
"default" = [ "async" "daemon" "wire" "nix-compat-derive" ];
"nix-compat-derive" = [ "dep:nix-compat-derive" ];
"pin-project-lite" = [ "dep:pin-project-lite" ];
"tokio" = [ "dep:tokio" ];
"wire" = [ "tokio" "pin-project-lite" "bytes" ];
};
resolvedDefaultFeatures = [ "async" "bytes" "default" "nix-compat-derive" "pin-project-lite" "tokio" "wire" ];
resolvedDefaultFeatures = [ "async" "bytes" "daemon" "default" "nix-compat-derive" "pin-project-lite" "tokio" "wire" ];
};
"nix-compat-derive" = rec {
crateName = "nix-compat-derive";
@ -3013,6 +3045,76 @@ rec {
};
resolvedDefaultFeatures = [ "default" "libm" "std" ];
};
"num_enum" = rec {
crateName = "num_enum";
version = "0.7.3";
edition = "2021";
sha256 = "0yai0vafhy85mvhknzfqd7lm04hzaln7i5c599rhy8mj831kyqaf";
authors = [
"Daniel Wagner-Hall <dawagner@gmail.com>"
"Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>"
"Vincent Esche <regexident@gmail.com>"
];
dependencies = [
{
name = "num_enum_derive";
packageId = "num_enum_derive";
usesDefaultFeatures = false;
}
];
features = {
"complex-expressions" = [ "num_enum_derive/complex-expressions" ];
"default" = [ "std" ];
"std" = [ "num_enum_derive/std" ];
};
resolvedDefaultFeatures = [ "default" "std" ];
};
"num_enum_derive" = rec {
crateName = "num_enum_derive";
version = "0.7.3";
edition = "2021";
sha256 = "0mksna1jj87ydh146gn6jcqkvvs920c3dgh0p4f3xk184kpl865g";
procMacro = true;
authors = [
"Daniel Wagner-Hall <dawagner@gmail.com>"
"Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>"
"Vincent Esche <regexident@gmail.com>"
];
dependencies = [
{
name = "proc-macro-crate";
packageId = "proc-macro-crate";
optional = true;
}
{
name = "proc-macro2";
packageId = "proc-macro2";
}
{
name = "quote";
packageId = "quote";
}
{
name = "syn";
packageId = "syn 2.0.79";
features = [ "parsing" ];
}
];
devDependencies = [
{
name = "syn";
packageId = "syn 2.0.79";
features = [ "extra-traits" "parsing" ];
}
];
features = {
"complex-expressions" = [ "syn/full" ];
"default" = [ "std" ];
"proc-macro-crate" = [ "dep:proc-macro-crate" ];
"std" = [ "proc-macro-crate" ];
};
resolvedDefaultFeatures = [ "proc-macro-crate" "std" ];
};
"object" = rec {
crateName = "object";
version = "0.32.1";
@ -3061,7 +3163,7 @@ rec {
"parking_lot" = [ "dep:parking_lot_core" ];
"std" = [ "alloc" ];
};
resolvedDefaultFeatures = [ "alloc" "default" "race" "std" "unstable" ];
resolvedDefaultFeatures = [ "alloc" "default" "race" "std" ];
};
"parquet-format-safe" = rec {
crateName = "parquet-format-safe";
@ -3455,7 +3557,7 @@ rec {
}
{
name = "hashbrown";
packageId = "hashbrown";
packageId = "hashbrown 0.14.5";
features = [ "rayon" "ahash" ];
}
{
@ -3638,7 +3740,7 @@ rec {
}
{
name = "hashbrown";
packageId = "hashbrown";
packageId = "hashbrown 0.14.5";
features = [ "rayon" "ahash" ];
}
{
@ -4179,7 +4281,7 @@ rec {
}
{
name = "hashbrown";
packageId = "hashbrown";
packageId = "hashbrown 0.14.5";
features = [ "rayon" "ahash" ];
}
{
@ -4445,7 +4547,7 @@ rec {
}
{
name = "hashbrown";
packageId = "hashbrown";
packageId = "hashbrown 0.14.5";
features = [ "rayon" "ahash" ];
}
{
@ -4919,7 +5021,7 @@ rec {
}
{
name = "hashbrown";
packageId = "hashbrown";
packageId = "hashbrown 0.14.5";
features = [ "rayon" "ahash" ];
}
{
@ -4980,6 +5082,23 @@ rec {
};
resolvedDefaultFeatures = [ "simd" "std" ];
};
"proc-macro-crate" = rec {
crateName = "proc-macro-crate";
version = "3.2.0";
edition = "2021";
sha256 = "0yzsqnavb3lmrcsmbrdjfrky9vcbl46v59xi9avn0796rb3likwf";
libName = "proc_macro_crate";
authors = [
"Bastian Köcher <git@kchr.de>"
];
dependencies = [
{
name = "toml_edit";
packageId = "toml_edit";
}
];
};
"proc-macro2" = rec {
crateName = "proc-macro2";
version = "1.0.87";
@ -6395,6 +6514,51 @@ rec {
};
resolvedDefaultFeatures = [ "default" "io" "io-util" ];
};
"toml_datetime" = rec {
crateName = "toml_datetime";
version = "0.6.8";
edition = "2021";
sha256 = "0hgv7v9g35d7y9r2afic58jvlwnf73vgd1mz2k8gihlgrf73bmqd";
authors = [
"Alex Crichton <alex@alexcrichton.com>"
];
features = {
"serde" = [ "dep:serde" ];
};
};
"toml_edit" = rec {
crateName = "toml_edit";
version = "0.22.22";
edition = "2021";
sha256 = "1xf7sxfzmnc45f75x302qrn5aph52vc8w226v59yhrm211i8vr2a";
authors = [
"Andronik Ordian <write@reusable.software>"
"Ed Page <eopage@gmail.com>"
];
dependencies = [
{
name = "indexmap";
packageId = "indexmap";
features = [ "std" ];
}
{
name = "toml_datetime";
packageId = "toml_datetime";
}
{
name = "winnow";
packageId = "winnow";
optional = true;
}
];
features = {
"default" = [ "parse" "display" ];
"parse" = [ "dep:winnow" ];
"perf" = [ "dep:kstring" ];
"serde" = [ "dep:serde" "toml_datetime/serde" "dep:serde_spanned" ];
};
resolvedDefaultFeatures = [ "default" "display" "parse" ];
};
"tracing" = rec {
crateName = "tracing";
version = "0.1.40";
@ -8233,6 +8397,28 @@ rec {
];
};
"winnow" = rec {
crateName = "winnow";
version = "0.6.20";
edition = "2021";
sha256 = "16y4i8z9vh8hazjxg5mvmq0c5i35wlk8rxi5gkq6cn5vlb0zxh9n";
dependencies = [
{
name = "memchr";
packageId = "memchr";
optional = true;
usesDefaultFeatures = false;
}
];
features = {
"debug" = [ "std" "dep:anstream" "dep:anstyle" "dep:is-terminal" "dep:terminal_size" ];
"default" = [ "std" ];
"simd" = [ "dep:memchr" ];
"std" = [ "alloc" "memchr?/std" ];
"unstable-doc" = [ "alloc" "std" "simd" "unstable-recover" ];
};
resolvedDefaultFeatures = [ "alloc" "default" "std" ];
};
"xxhash-rust" = rec {
crateName = "xxhash-rust";
version = "0.8.7";

View file

@ -15,6 +15,9 @@ nix-compat = { version = "0.1.0", path = "../../../tvix/nix-compat" }
tempfile-fast = "0.3.4"
zstd = "0.13.0"
# See https://github.com/pola-rs/polars/issues/19157
hashbrown = { version = "0.14.5", features = ["raw"] }
[dependencies.polars]
version = "0.36.2"
default-features = false