about summary refs log tree commit diff
path: root/tvix/nix-compat/src/wire/bytes_writer.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-04-13 r/7896 refactor(tvix/nix-compat): reorganize wire and bytesFlorian Klink1-543/+0
Move everything bytes-related into its own module, and re-export both bytes and primitive in a flat space from wire/mod.rs. Expose this if a `wire` feature flag is set. We only have `async` stuff in here. Change-Id: Ia4ce4791f13a5759901cc9d6ce6bd6bbcca587c7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11389 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Reviewed-by: Brian Olsen <me@griff.name>
2024-04-13 r/7894 feat(tvix/nix-compat): add BytesReaderFlorian Klink1-1/+3
This adds AsyncRead counterpart for read_bytes. Change-Id: I751da9944984c7a523abee305f8f8a050e705f04 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11385 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: Brian Olsen <me@griff.name> Autosubmit: flokli <flokli@flokli.de>
2024-04-09 r/7883 fix(tvix/nix-compat): fix writing padding partiallyFlorian Klink1-1/+28
We forgot to only write the part of the padding that has not been written already. Unfortunately it seems the tokio mocking thing does buffer small writes, so the tests succeeds even with the bug :-/ Change-Id: I5a6cf04212d559728639427c57207094d507ec75 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11384 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: Brian Olsen <me@griff.name> Autosubmit: flokli <flokli@flokli.de>
2024-04-08 r/7879 refactor(tvix/nix-compat/wire): rename padding_len to total_padding_lenFlorian Klink1-3/+3
Make it a bit more clear that this is the total padding length, not the padding length we still need to write. Change-Id: I9ff4aa16f256fda367b4b9295abf82ed01b1f989 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11383 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr>
2024-04-08 r/7878 refactor(tvix/nix-compat/wire): mv Bytes{WriterState,PacketPosition}Florian Klink1-24/+25
This is perfectly fine to track the position inside a reader too, so rename it to reflect that. Also make the docstring a bit less write-specific. Change-Id: I831b0a8fe44a2477d4af96fefc692b9aabc378f1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11382 Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
2024-04-08 r/7877 fix(tvix/nix-compat/wire): fix BytesWriter test payloadsFlorian Klink1-4/+4
We actually did construct other payload sizes than the test function was intended to, because I'm too stupid to count. Fix that, and also update a leftover _debug in a test name. Change-Id: I1bff8551f2078afe82f789646b851f2fcff3e82c Reviewed-on: https://cl.tvl.fyi/c/depot/+/11381 Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2024-04-08 r/7872 refactor(tvix/nix-compat/wire): simplify write_bytes a bitFlorian Klink1-3/+2
Use the same EMPTY_BYTES trick from BytesWriter to write out the padding, rather than allocating a Vec. Change-Id: Ifb4ba1b45b7388adbc135fc8e46fd3d3cedd30aa Reviewed-on: https://cl.tvl.fyi/c/depot/+/11375 Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2024-04-06 r/7857 feat(tvix/nix-compat/wire): introduce BytesWriterFlorian Klink1-0/+514
This deals with writing byte packets of larger sizes to an underlying AsyncWrite. Its constructor receives the expected size. It also deals with writing padding if flush/shutdown is called after writing all the payload. Change-Id: I8acbf992467f3862ffb8c7d669e8c0c8eced14c1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11355 Reviewed-by: picnoir picnoir <picnoir@alternativebit.fr> Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Brian Olsen <me@griff.name> Tested-by: BuildkiteCI