diff options
Diffstat (limited to 'tvix')
27 files changed, 44 insertions, 48 deletions
diff --git a/tvix/nix-compat-derive-tests/tests/read_derive.rs b/tvix/nix-compat-derive-tests/tests/read_derive.rs index e47c8ad4346f..56123026fc75 100644 --- a/tvix/nix-compat-derive-tests/tests/read_derive.rs +++ b/tvix/nix-compat-derive-tests/tests/read_derive.rs @@ -1,7 +1,7 @@ use std::str::FromStr; -use nix_compat::nix_daemon::de::mock::{Builder, Error}; -use nix_compat::nix_daemon::de::NixRead; +use nix_compat::wire::de::mock::{Builder, Error}; +use nix_compat::wire::de::NixRead; use nix_compat_derive::NixDeserialize; #[derive(Debug, PartialEq, Eq, NixDeserialize)] diff --git a/tvix/nix-compat-derive-tests/tests/ui/deserialize_bad_type.stderr b/tvix/nix-compat-derive-tests/tests/ui/deserialize_bad_type.stderr index 12ffdc83c726..9a57d5e2d15e 100644 --- a/tvix/nix-compat-derive-tests/tests/ui/deserialize_bad_type.stderr +++ b/tvix/nix-compat-derive-tests/tests/ui/deserialize_bad_type.stderr @@ -15,7 +15,7 @@ error[E0277]: the trait bound `BadType: NixDeserialize` is not satisfied u64 usize note: required by a bound in `try_read_value` - --> $WORKSPACE/nix-compat/src/nix_daemon/de/mod.rs + --> $WORKSPACE/nix-compat/src/wire/de/mod.rs | | fn try_read_value<V: NixDeserialize>( | ^^^^^^^^^^^^^^ required by this bound in `NixRead::try_read_value` diff --git a/tvix/nix-compat-derive-tests/tests/ui/deserialize_from_str_error_not_display.stderr b/tvix/nix-compat-derive-tests/tests/ui/deserialize_from_str_error_not_display.stderr index 8283ed5340f3..9041e261c605 100644 --- a/tvix/nix-compat-derive-tests/tests/ui/deserialize_from_str_error_not_display.stderr +++ b/tvix/nix-compat-derive-tests/tests/ui/deserialize_from_str_error_not_display.stderr @@ -7,7 +7,7 @@ error[E0277]: `()` doesn't implement `std::fmt::Display` = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead note: required by a bound in `invalid_data` - --> $WORKSPACE/nix-compat/src/nix_daemon/de/mod.rs + --> $WORKSPACE/nix-compat/src/wire/de/mod.rs | | fn invalid_data<T: fmt::Display>(msg: T) -> Self { | ^^^^^^^^^^^^ required by this bound in `Error::invalid_data` diff --git a/tvix/nix-compat-derive-tests/tests/ui/deserialize_remote_missing_attr.stderr b/tvix/nix-compat-derive-tests/tests/ui/deserialize_remote_missing_attr.stderr index a1c18adc6e48..fe6047ba5ef3 100644 --- a/tvix/nix-compat-derive-tests/tests/ui/deserialize_remote_missing_attr.stderr +++ b/tvix/nix-compat-derive-tests/tests/ui/deserialize_remote_missing_attr.stderr @@ -1,5 +1,6 @@ error: Missing from_str, from or try_from attribute - --> tests/ui/deserialize_remote_missing_attr.rs:10:25 + --> tests/ui/deserialize_remote_missing_attr.rs:11:5 | -10 | nix_deserialize_remote!(#[nix()] Value); - | ^^^^^^^^^^^^^^ +11 | / #[nix()] +12 | | Value + | |_________^ diff --git a/tvix/nix-compat-derive-tests/tests/ui/deserialize_try_from_error_not_display.stderr b/tvix/nix-compat-derive-tests/tests/ui/deserialize_try_from_error_not_display.stderr index 8e55a3c56189..27a2aa10abd7 100644 --- a/tvix/nix-compat-derive-tests/tests/ui/deserialize_try_from_error_not_display.stderr +++ b/tvix/nix-compat-derive-tests/tests/ui/deserialize_try_from_error_not_display.stderr @@ -7,7 +7,7 @@ error[E0277]: `()` doesn't implement `std::fmt::Display` = help: the trait `std::fmt::Display` is not implemented for `()` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead note: required by a bound in `invalid_data` - --> $WORKSPACE/nix-compat/src/nix_daemon/de/mod.rs + --> $WORKSPACE/nix-compat/src/wire/de/mod.rs | | fn invalid_data<T: fmt::Display>(msg: T) -> Self { | ^^^^^^^^^^^^ required by this bound in `Error::invalid_data` diff --git a/tvix/nix-compat-derive-tests/tests/write_derive.rs b/tvix/nix-compat-derive-tests/tests/write_derive.rs index 1ed5dbf7e735..435b7be7585d 100644 --- a/tvix/nix-compat-derive-tests/tests/write_derive.rs +++ b/tvix/nix-compat-derive-tests/tests/write_derive.rs @@ -1,6 +1,6 @@ use std::fmt; -use nix_compat::nix_daemon::ser::{ +use nix_compat::wire::ser::{ mock::{Builder, Error}, NixWrite as _, }; diff --git a/tvix/nix-compat-derive/src/de.rs b/tvix/nix-compat-derive/src/de.rs index e678b50b0533..d9779713dfaa 100644 --- a/tvix/nix-compat-derive/src/de.rs +++ b/tvix/nix-compat-derive/src/de.rs @@ -58,12 +58,12 @@ fn nix_deserialize_impl( quote! { #[automatically_derived] - impl #impl_generics #crate_path::nix_daemon::de::NixDeserialize for #ty #ty_generics + impl #impl_generics #crate_path::wire::de::NixDeserialize for #ty #ty_generics #where_clause { #[allow(clippy::manual_async_fn)] fn try_deserialize<R>(reader: &mut R) -> impl ::std::future::Future<Output=Result<Option<Self>, R::Error>> + Send + '_ - where R: ?Sized + #crate_path::nix_daemon::de::NixRead + Send, + where R: ?Sized + #crate_path::wire::de::NixRead + Send, { #body } @@ -253,7 +253,7 @@ fn nix_deserialize_try_from(crate_path: &Path, ty: &Type) -> TokenStream { quote_spanned! { ty.span() => async move { - use #crate_path::nix_daemon::de::Error; + use #crate_path::wire::de::Error; if let Some(item) = reader.try_read_value::<#ty>().await? { <Self as ::std::convert::TryFrom<#ty>>::try_from(item) .map_err(Error::invalid_data) @@ -269,7 +269,7 @@ fn nix_deserialize_from_str(crate_path: &Path, span: Span) -> TokenStream { quote_spanned! { span => async move { - use #crate_path::nix_daemon::de::Error; + use #crate_path::wire::de::Error; if let Some(buf) = reader.try_read_bytes().await? { let s = ::std::str::from_utf8(&buf) .map_err(Error::invalid_data)?; diff --git a/tvix/nix-compat-derive/src/ser.rs b/tvix/nix-compat-derive/src/ser.rs index 47ddfa39366d..52e777c28cf4 100644 --- a/tvix/nix-compat-derive/src/ser.rs +++ b/tvix/nix-compat-derive/src/ser.rs @@ -55,13 +55,13 @@ fn nix_serialize_impl( quote! { #[automatically_derived] - impl #impl_generics #crate_path::nix_daemon::ser::NixSerialize for #ty #ty_generics + impl #impl_generics #crate_path::wire::ser::NixSerialize for #ty #ty_generics #where_clause { async fn serialize<W>(&self, writer: &mut W) -> std::result::Result<(), W::Error> - where W: #crate_path::nix_daemon::ser::NixWrite + where W: #crate_path::wire::ser::NixWrite { - use #crate_path::nix_daemon::ser::Error as _; + use #crate_path::wire::ser::Error as _; #body } } @@ -207,7 +207,7 @@ fn nix_serialize_try_into(crate_path: &Path, ty: &Type) -> TokenStream { quote_spanned! { ty.span() => { - use #crate_path::nix_daemon::ser::Error; + use #crate_path::wire::ser::Error; let other : #ty = <Self as Clone>::clone(self).try_into().map_err(Error::unsupported_data)?; writer.write_value(&other).await } diff --git a/tvix/nix-compat/src/lib.rs b/tvix/nix-compat/src/lib.rs index f30c557889a8..ae9f1674468e 100644 --- a/tvix/nix-compat/src/lib.rs +++ b/tvix/nix-compat/src/lib.rs @@ -18,5 +18,3 @@ pub mod wire; pub mod nix_daemon; #[cfg(feature = "wire")] pub use nix_daemon::worker_protocol; -#[cfg(feature = "wire")] -pub use nix_daemon::ProtocolVersion; diff --git a/tvix/nix-compat/src/nix_daemon/mod.rs b/tvix/nix-compat/src/nix_daemon/mod.rs index a943b279f891..633fdbebd47c 100644 --- a/tvix/nix-compat/src/nix_daemon/mod.rs +++ b/tvix/nix-compat/src/nix_daemon/mod.rs @@ -1,7 +1 @@ pub mod worker_protocol; - -mod protocol_version; -pub use protocol_version::ProtocolVersion; - -pub mod de; -pub mod ser; diff --git a/tvix/nix-compat/src/nix_daemon/worker_protocol.rs b/tvix/nix-compat/src/nix_daemon/worker_protocol.rs index cc99bdb54fab..92259a0633a0 100644 --- a/tvix/nix-compat/src/nix_daemon/worker_protocol.rs +++ b/tvix/nix-compat/src/nix_daemon/worker_protocol.rs @@ -10,7 +10,7 @@ use tokio::io::{AsyncReadExt, AsyncWriteExt}; use crate::wire; -use super::ProtocolVersion; +use crate::wire::ProtocolVersion; static WORKER_MAGIC_1: u64 = 0x6e697863; // "nixc" static WORKER_MAGIC_2: u64 = 0x6478696f; // "dxio" diff --git a/tvix/nix-compat/src/nix_daemon/de/bytes.rs b/tvix/nix-compat/src/wire/de/bytes.rs index 7daced54eef7..4c64247f7051 100644 --- a/tvix/nix-compat/src/nix_daemon/de/bytes.rs +++ b/tvix/nix-compat/src/wire/de/bytes.rs @@ -34,7 +34,7 @@ mod test { use rstest::rstest; use tokio_test::io::Builder; - use crate::nix_daemon::de::{NixRead, NixReader}; + use crate::wire::de::{NixRead, NixReader}; #[rstest] #[case::empty("", &hex!("0000 0000 0000 0000"))] diff --git a/tvix/nix-compat/src/nix_daemon/de/collections.rs b/tvix/nix-compat/src/wire/de/collections.rs index cf79f584506a..e1271635e4e6 100644 --- a/tvix/nix-compat/src/nix_daemon/de/collections.rs +++ b/tvix/nix-compat/src/wire/de/collections.rs @@ -64,7 +64,7 @@ mod test { use rstest::rstest; use tokio_test::io::Builder; - use crate::nix_daemon::de::{NixDeserialize, NixRead, NixReader}; + use crate::wire::de::{NixDeserialize, NixRead, NixReader}; #[rstest] #[case::empty(vec![], &hex!("0000 0000 0000 0000"))] diff --git a/tvix/nix-compat/src/nix_daemon/de/int.rs b/tvix/nix-compat/src/wire/de/int.rs index eecf641cfe99..d505de9b1b24 100644 --- a/tvix/nix-compat/src/nix_daemon/de/int.rs +++ b/tvix/nix-compat/src/wire/de/int.rs @@ -45,7 +45,7 @@ mod test { use rstest::rstest; use tokio_test::io::Builder; - use crate::nix_daemon::de::{NixRead, NixReader}; + use crate::wire::de::{NixRead, NixReader}; #[rstest] #[case::simple_false(false, &hex!("0000 0000 0000 0000"))] diff --git a/tvix/nix-compat/src/nix_daemon/de/mock.rs b/tvix/nix-compat/src/wire/de/mock.rs index 31cc3a4897ba..8a1fb817743c 100644 --- a/tvix/nix-compat/src/nix_daemon/de/mock.rs +++ b/tvix/nix-compat/src/wire/de/mock.rs @@ -6,7 +6,7 @@ use std::thread; use bytes::Bytes; use thiserror::Error; -use crate::nix_daemon::ProtocolVersion; +use crate::wire::ProtocolVersion; use super::NixRead; @@ -189,7 +189,7 @@ mod test { use bytes::Bytes; use hex_literal::hex; - use crate::nix_daemon::de::NixRead; + use crate::wire::de::NixRead; use super::{Builder, Error}; diff --git a/tvix/nix-compat/src/nix_daemon/de/mod.rs b/tvix/nix-compat/src/wire/de/mod.rs index f85ccd8fea0e..f85ccd8fea0e 100644 --- a/tvix/nix-compat/src/nix_daemon/de/mod.rs +++ b/tvix/nix-compat/src/wire/de/mod.rs diff --git a/tvix/nix-compat/src/nix_daemon/de/reader.rs b/tvix/nix-compat/src/wire/de/reader.rs index 87c623b2220c..b7825f393c4e 100644 --- a/tvix/nix-compat/src/nix_daemon/de/reader.rs +++ b/tvix/nix-compat/src/wire/de/reader.rs @@ -8,8 +8,7 @@ use bytes::{Buf, BufMut, Bytes, BytesMut}; use pin_project_lite::pin_project; use tokio::io::{AsyncBufRead, AsyncRead, AsyncReadExt, ReadBuf}; -use crate::nix_daemon::ProtocolVersion; -use crate::wire::EMPTY_BYTES; +use crate::wire::{ProtocolVersion, EMPTY_BYTES}; use super::{Error, NixRead}; @@ -270,7 +269,7 @@ mod test { use tokio_test::io::Builder; use super::*; - use crate::nix_daemon::de::NixRead; + use crate::wire::de::NixRead; #[tokio::test] async fn test_read_u64() { diff --git a/tvix/nix-compat/src/wire/mod.rs b/tvix/nix-compat/src/wire/mod.rs index a197e3a1f451..c3e88dda05ec 100644 --- a/tvix/nix-compat/src/wire/mod.rs +++ b/tvix/nix-compat/src/wire/mod.rs @@ -3,3 +3,9 @@ mod bytes; pub use bytes::*; + +mod protocol_version; +pub use protocol_version::ProtocolVersion; + +pub mod de; +pub mod ser; diff --git a/tvix/nix-compat/src/nix_daemon/protocol_version.rs b/tvix/nix-compat/src/wire/protocol_version.rs index 19da28d484dd..19da28d484dd 100644 --- a/tvix/nix-compat/src/nix_daemon/protocol_version.rs +++ b/tvix/nix-compat/src/wire/protocol_version.rs diff --git a/tvix/nix-compat/src/nix_daemon/ser/bytes.rs b/tvix/nix-compat/src/wire/ser/bytes.rs index 19494934ff32..4338d3f8761e 100644 --- a/tvix/nix-compat/src/nix_daemon/ser/bytes.rs +++ b/tvix/nix-compat/src/wire/ser/bytes.rs @@ -45,7 +45,7 @@ mod test { use tokio::io::AsyncWriteExt as _; use tokio_test::io::Builder; - use crate::nix_daemon::ser::{NixWrite, NixWriter}; + use crate::wire::ser::{NixWrite, NixWriter}; #[rstest] #[case::empty("", &hex!("0000 0000 0000 0000"))] diff --git a/tvix/nix-compat/src/nix_daemon/ser/collections.rs b/tvix/nix-compat/src/wire/ser/collections.rs index 70c32e1c79ac..478e1d04d809 100644 --- a/tvix/nix-compat/src/nix_daemon/ser/collections.rs +++ b/tvix/nix-compat/src/wire/ser/collections.rs @@ -53,7 +53,7 @@ mod test { use tokio::io::AsyncWriteExt as _; use tokio_test::io::Builder; - use crate::nix_daemon::ser::{NixSerialize, NixWrite, NixWriter}; + use crate::wire::ser::{NixSerialize, NixWrite, NixWriter}; #[rstest] #[case::empty(vec![], &hex!("0000 0000 0000 0000"))] diff --git a/tvix/nix-compat/src/nix_daemon/ser/display.rs b/tvix/nix-compat/src/wire/ser/display.rs index a3438d50d8ff..a3438d50d8ff 100644 --- a/tvix/nix-compat/src/nix_daemon/ser/display.rs +++ b/tvix/nix-compat/src/wire/ser/display.rs diff --git a/tvix/nix-compat/src/nix_daemon/ser/int.rs b/tvix/nix-compat/src/wire/ser/int.rs index 1be06442e322..e68179c71dc7 100644 --- a/tvix/nix-compat/src/nix_daemon/ser/int.rs +++ b/tvix/nix-compat/src/wire/ser/int.rs @@ -67,7 +67,7 @@ mod test { use tokio::io::AsyncWriteExt as _; use tokio_test::io::Builder; - use crate::nix_daemon::ser::{NixWrite, NixWriter}; + use crate::wire::ser::{NixWrite, NixWriter}; #[rstest] #[case::simple_false(false, &hex!("0000 0000 0000 0000"))] diff --git a/tvix/nix-compat/src/nix_daemon/ser/mock.rs b/tvix/nix-compat/src/wire/ser/mock.rs index 1319a8da3228..7104a94238ff 100644 --- a/tvix/nix-compat/src/nix_daemon/ser/mock.rs +++ b/tvix/nix-compat/src/wire/ser/mock.rs @@ -7,7 +7,7 @@ use std::thread; use ::proptest::prelude::TestCaseError; use thiserror::Error; -use crate::nix_daemon::ProtocolVersion; +use crate::wire::ProtocolVersion; use super::NixWrite; @@ -491,11 +491,11 @@ mod test { use proptest::prelude::TestCaseError; use proptest::proptest; - use crate::nix_daemon::ser::mock::proptest::arb_extra_write; - use crate::nix_daemon::ser::mock::Operation; - use crate::nix_daemon::ser::mock::OperationType; - use crate::nix_daemon::ser::Error as _; - use crate::nix_daemon::ser::NixWrite; + use crate::wire::ser::mock::proptest::arb_extra_write; + use crate::wire::ser::mock::Operation; + use crate::wire::ser::mock::OperationType; + use crate::wire::ser::Error as _; + use crate::wire::ser::NixWrite; use super::{Builder, Error}; diff --git a/tvix/nix-compat/src/nix_daemon/ser/mod.rs b/tvix/nix-compat/src/wire/ser/mod.rs index 5860226f39eb..5860226f39eb 100644 --- a/tvix/nix-compat/src/nix_daemon/ser/mod.rs +++ b/tvix/nix-compat/src/wire/ser/mod.rs diff --git a/tvix/nix-compat/src/nix_daemon/ser/writer.rs b/tvix/nix-compat/src/wire/ser/writer.rs index 87e30580af34..da1c2b18c5e2 100644 --- a/tvix/nix-compat/src/nix_daemon/ser/writer.rs +++ b/tvix/nix-compat/src/wire/ser/writer.rs @@ -8,9 +8,7 @@ use bytes::{Buf, BufMut, BytesMut}; use pin_project_lite::pin_project; use tokio::io::{AsyncWrite, AsyncWriteExt}; -use crate::nix_daemon::ProtocolVersion; -use crate::wire::padding_len; -use crate::wire::EMPTY_BYTES; +use crate::wire::{padding_len, ProtocolVersion, EMPTY_BYTES}; use super::{Error, NixWrite}; @@ -225,7 +223,7 @@ mod test { use tokio::io::AsyncWriteExt as _; use tokio_test::io::Builder; - use crate::nix_daemon::ser::NixWrite; + use crate::wire::ser::NixWrite; use super::NixWriter; diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs index 0ae18ec2161a..75f1ec11d56e 100644 --- a/tvix/store/src/bin/tvix-store.rs +++ b/tvix/store/src/bin/tvix-store.rs @@ -3,9 +3,9 @@ use clap::Subcommand; use futures::StreamExt; use futures::TryStreamExt; -use nix_compat::nix_daemon::de::Error; use nix_compat::nixhash::CAHash; use nix_compat::nixhash::NixHash; +use nix_compat::wire::de::Error; use nix_compat::{path_info::ExportedPathInfo, store_path::StorePath}; use serde::Deserialize; use serde::Serialize; |