about summary refs log tree commit diff
path: root/tvix (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-01-04 r/5590 chore(tvix/derivation): align json serialization with nix outputFlorian Klink11-103/+113
Use the #[serde(rename = "…")] field attributes to match the field names that Nix uses in its JSON output (nix show-derivation). This allows us to just re-use the exact same fixtures from go-nix, without manual post-massaging. Change-Id: Ifd5c08e43cd4f50d5e02903eccd8cb37230b70a6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7757 Reviewed-by: jrhahn <mail.jhahn@gmail.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5589 refactor(tvix/derivation): make output hashes an Option<Hash>Florian Klink2-29/+35
This conveys better if an output of a Derivation is fixed-output or not, and provides a Hash struct that can be used to store the algo and digest. In case it's not, this can simply be None. The serde field attributes have been updated to still accept the same JSON. We currently still store the hash algo and digest as strings, mostly because the only thing populating it so far is the example JSONs. We might want to update this, once actual Nix code populates this. While updating write.rs, I pushed some of the Vec<String> to [&str] conversions inline, and made it a Vec<&str>, because it was annoying to juggle with. Change-Id: Ia9cd0568fe179ac22a4a636237f22ab4ad92b95b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7746 Tested-by: BuildkiteCI Reviewed-by: jrhahn <mail.jhahn@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5588 feat(tvix/derivation): make struct members publicFlorian Klink1-7/+7
Allow others to peek into values. We should probably still restrict this further at a later point. Change-Id: I2831432038aa87c3c7dcc85af4fa76a4fe0eadff Reviewed-on: https://cl.tvl.fyi/c/depot/+/7745 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-04 r/5587 refactor(tvix/derivation): use tvix_store::nixpath::STORE_DIRFlorian Klink2-2/+4
There's now a common constant for this, so we don't need to redefine it here. Change-Id: I48b096f5e623e5fc5bbd355db83b674766935f94 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7753 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5586 feat(tvix/store): implement Nixpath::from_absolute_pathFlorian Klink1-1/+39
This allows constructing a NixPath from an absolute path. It pops off the STORE_DIR prefix and the trailing slash and returns an error if it couldn't be found. Change-Id: Ib540e353c63cc247ac15e20414b0db2caf695ef4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7751 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5585 feat(tvix/serde): implement enum deserialisationVincent Ambo4-7/+189
Implements externally tagged enum deserialisation. Other serialisation methods are handled by serde internally using the existing methods. See the tests for examples. Change-Id: Ic4a9da3b5a32ddbb5918b1512e70c3ac5ce64f04 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7721 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de>
2023-01-04 r/5584 feat(tvix/serde): add newtype & tuple deserialisationVincent Ambo2-10/+27
Only missing enums at this point, but they're a bit of a beast. Change-Id: I4ad47c034851f9a8794c81f39a5149a8ac1826e8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7716 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Autosubmit: tazjin <tazjin@tvl.su>
2023-01-04 r/5583 refactor(tvix/eval): avoid unnecessary pop/push in OpForceVincent Ambo1-6/+1
Change-Id: Ic7559eaa43aa0dcc97babb7669770c0f7f959f1b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7754 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2023-01-04 r/5582 fix(tvix/eval): ' is allowed in nonfirst position in Nix identifierssterni3-1/+32
With this is_valid_nix_identifier should line up with the upstream lexer definition: ID [a-zA-Z\_][a-zA-Z0-9\_\'\-]* While we're working on this, add a simple test checking the various formatting rules. Interestingly, it would not be suitable as an identity test, since you have to write { "assert" = null; } in order to avoid an evaluation error, but C++ Nix is happy to print this as { assert = null; } – maybe should be considered to be a bug. Change-Id: I0a4e1ccb5033a80f3767fb8d1c4bba08d303c5d8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7744 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5581 refactor(tvix/eval): streamline construction of globals/builtinsVincent Ambo7-219/+270
Previously the construction of globals (a compiler-only concept) and builtins (a (now) user-facing API) was intermingled between multiple different modules, and kind of difficult to understand. The complexity of this had grown in large part due to the implementation of `builtins.import`, which required the notorious "knot-tying" trick using Rc::new_cyclic (see cl/7097) for constructing the set of globals. As part of the new `Evaluation` API users should have the ability to bring their own builtins, and control explicitly whether or not impure builtins are available (regardless of whether they're compiled in or not). To streamline the construction and allow the new API features to work, this commit restructures things by making these changes: 1. The `tvix_eval::builtins` module is now only responsible for exporting sets of builtins. It no longer has any knowledge of whether or not certain sets (e.g. only pure, or pure+impure) are enabled, and it has no control over which builtins are globally available (this is now handled in the compiler). 2. The compiler module is now responsible for both constructing the final attribute set of builtins from the set of builtins supplied by a user, as well as for populating its globals (that is identifiers which are available at the top-level scope). 3. The `Evaluation` API now carries a `builtins` field which is populated with the pure builtins by default, and can be extended by users. 4. The `import` feature has been moved into the compiler, as a special case. In general, builtins no longer have the ability to reference the "fix point" of the globals set. This should not change any functionality, and in fact preserves minor differences between Tvix/Nix that we already had (such as `builtins.builtins` not existing). Change-Id: Icdf5dd50eb81eb9260d89269d6e08b1e67811a2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7738 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-01-04 r/5580 feat(tvix/derivation): add nix drv path generation to DerivationJürgen Hahn7-4/+137
This adds a function to generate the derivation path. The computation is based on the Go implementation. Change-Id: Iae89db4976f5fd9208f0453f73688689a245cd66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7729 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-01-04 r/5579 docs(feat/derivation): add docstring to formatterJürgen Hahn1-0/+1
This is just to clarify that the formatted result is the ATerm representation Change-Id: I98fd0b1d2daa3cf6fdbe526ae1e0bd100ff62df3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7742 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-01-04 r/5577 feat(tvix/derivation) Add fmt::Display implementation for DerivationJürgen Hahn3-22/+42
This adds the implementation of fmt::Display for Derivation so that we can easily store the formatted content as a string. Internally, we use the serialization function to generate the string. Change-Id: I6caca0d6c1bea3ca44b6c535c5b1d5d66d8413b7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7741 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-01-03 r/5576 test(tvix/serde): add initial set of deserialisation testsVincent Ambo4-1/+87
Change-Id: I0a9779edf0296c25d37fb5f75f8fc5852fe00121 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7715 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de>
2023-01-03 r/5575 feat(tvix/serde): handle nested data structuresVincent Ambo1-12/+55
Change-Id: I543fc05d31bbb9ad2edb887bce4510e9a1cdb102 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7714 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de>
2023-01-03 r/5572 feat(tvix/store/nixpath): DIGEST_SIZE public, use more constsFlorian Klink1-12/+18
Rename PATH_HASH_SIZE to DIGEST_SIZE. It's a digest, not hash (we don't necessarily have the internal hash state anymore), and the fact it's about (Nix)Paths is already visible from the module name. Also expose ENCODED_DIGEST_SIZE, so we don't need to do the calculation inside from_string() method, and it becomes more clear this is a constant. Change-Id: I0e7577dd7a6e503039037b986313b214e995d826 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7725 Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: jrhahn <mail.jhahn@gmail.com> Tested-by: BuildkiteCI
2023-01-03 r/5571 feat(tvix/store/nixpath): expose digest and name fieldsFlorian Klink1-2/+2
These can be accessed directly. Change-Id: I71dc84f982820d53f319efefbed9b9055034954d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7724 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-03 r/5570 feat(src/proto): add PathInfo.validate()Florian Klink3-0/+307
This provides validation of PathInfo messages, and ensures the output hashes are properly parsed from the root node names. NixPath already has a more extensive test suite for various wrong NixPaths, so it's omitted from here. Change-Id: I5d69118df5816daabb521ddb19d178bddd1caacf Reviewed-on: https://cl.tvl.fyi/c/depot/+/7684 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-03 r/5569 chore(tvix/store): make importableFlorian Klink6-26/+35
This allows other crates to import tvix_store. Rename the bin crate to tvix-store-bin, to avoid having multiple crates with the same name (https://github.com/rust-lang/cargo/issues/6313) Change-Id: I857768d6115640dbf102e79ed03e8474090df2fe Reviewed-on: https://cl.tvl.fyi/c/depot/+/7728 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-03 r/5568 chore(tvix/store/nixbase32): address clippyFlorian Klink1-1/+1
Change-Id: Ib47a55e39ed752492b9732439de5f327a7fa601e Reviewed-on: https://cl.tvl.fyi/c/depot/+/7723 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-03 r/5567 chore(tvix/store/main): address clippyFlorian Klink1-1/+1
Change-Id: Ie400a7109d3aa6b66153c0ab25a38abf06984cbf Reviewed-on: https://cl.tvl.fyi/c/depot/+/7722 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-02 r/5566 feat(tvix/serde): initial Nix->serde::Deserialize implVincent Ambo8-0/+485
This will make it possible fairly easily use Nix to represent arbitrary data structures, e.g. for using Nix as a config language. Only pure Nix (i.e. no `import` etc.) is supported for now. Not all types, specifically no struct traversal, are implemented in this commit. Change-Id: I9ac91a229a0d12bf818e6e3249f3e5a691599a2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7712 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-01-02 r/5565 chore(tvix/eval): implement std::error::Error for tvix_eval::ErrorVincent Ambo2-1/+20
This makes it easier to interface this error with other crates. Change-Id: I4947ea6097608f8c0427fb94a819ef748d94ea4b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7711 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-01-02 r/5564 refactor(tvix/derivation): refactor the derivation serializationJürgen Hahn6-215/+248
This refactors the code to serialize a derivation. The original code has beed moved to seperate crates for better code structure. Change-Id: I3b1a6b134428fcbc9930c330bced8ec3610cfb4c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7733 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2022-12-30 r/5558 feat(tvix/store): add logging with tracingFlorian Klink7-10/+327
This uses [tracing](https://github.com/tokio-rs/tracing) for logs/ tracing. Annotate all method handlers with an instrument macro, and warn! a message for them being unimplemented. Co-Authored-By: Márton Boros <martonboros@gmail.com> Change-Id: Id42a41db33782d82abfb8dc0e49a8915000e5d89 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7665 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-30 r/5557 feat(tvix/store): implement reflectionFlorian Klink7-27/+144
This implements grpc.reflection.v1alpha.ServerReflection, and will make tools like evans automatically discover available services, without having to specify the path to the .proto files client-side. It's behind a reflection feature flag, which is enabled by default. Change-Id: Icbcb5eb05ceede5b9952e38a2ba72eaa6fa8a437 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7435 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-30 r/5556 refactor(tvix/store): make nixbase32 reversal more idiomaticedef1-7/+4
Change-Id: Ibe550f9573b0f45ee95453b50c7510e49b07c719 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7685 Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-30 r/5555 feat(tvix/store): refactor digest conversionJürgen Hahn2-6/+2
This refactors how the original digest type (Vec<u8>) is converted to [u8; PATH_HASH_SIZE]. Change-Id: I9441470a3a199620fcf328f2b7c890ca6ae93bde Reviewed-on: https://cl.tvl.fyi/c/depot/+/7710 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2022-12-30 r/5554 feat(tvix/store): initial dummy implementationFlorian Klink7-22/+175
This replaces the hello world example from tvix-store with an actual gRPC endpoint, implementing all of BlobService, DirectoryService and PathInfoService. All RPC methods currently respond with the unimplemented gRPC status. Co-Authored-By: Márton Boros <martonboros@gmail.com> Change-Id: Ieba333cca44dc1e3f2ffbe676ba7a99e672b9bfb Reviewed-on: https://cl.tvl.fyi/c/depot/+/7664 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-30 r/5553 chore(tvix/store/protos): more idiomatic goFlorian Klink1-3/+1
Pointed out by edef in https://cl.tvl.fyi/c/depot/+/7648/comment/4551ba4b_e89ade36/#, thanks! Change-Id: I6b0d317bb0210521622483cdf4cb557bc637a100 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7709 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su>
2022-12-30 r/5552 feat(tvix/store): parameterise validate_digest errorFlorian Klink1-4/+7
Similar to cl/7682, we also want to make that error configurable. Change-Id: I64f1a4570b3d75af4741abe10c2855959766e107 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7708 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-12-30 r/5551 feat(tvix/store): add nixpathJürgen Hahn2-0/+143
This implements the NixPath structure. NixPath allow to parse a string to a nix path. If the parsing fails, a DecodeError will be raised. Change-Id: I28363cdcfb27f04bf21a11c0d130b461667e3720 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7706 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-12-30 r/5550 feat(tvix/store): add nixbase32 modFlorian Klink5-33/+247
This implements the nix-specific base32 encoding and decoding, exposing a subset of the API that the data-encoding crate provides. Nix uses a custom alphabet, no padding, and encodes bytes in reverse order. The latter one is the reason we can't just use the data-encoding crate directly. Three odd corner case tests ported over from go-nix failed. We opened b/235 to further investigate. Change-Id: I73fab6ddd67177d882e4c3f2b48761c95853d558 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7683 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2022-12-29 r/5549 feat(tvix/store): parameterise validate_node_name errorFlorian Klink1-9/+8
We'll be using validate_node_name in other places in a bit, where returning a ValidateDirectoryError is not appropriate. Accept a function mapping a string to error as a second argument, and pass ValidateDirectoryError::InvalidName at the current call sites. Change-Id: I45cbb0deb4763061ad912c6b18a112c727795a17 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7682 Tested-by: BuildkiteCI Reviewed-by: jrhahn <mail.jhahn@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
2022-12-29 r/5548 fix(tvix/store): fix typoFlorian Klink1-1/+1
Change-Id: I351a2bd4e007443aef1b97f50aecffc095ac60b1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7681 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: jrhahn <mail.jhahn@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su>
2022-12-29 r/5542 refactor(tvix/eval): remove extra Rc<..> around Value::AttrsVincent Ambo5-21/+24
The `im::OrdMap` is already small and cheap to copy while sharing memory, so this is not required anymore. Only the `KV` variant may have slightly larger content, but in practice this doesn't seem to make a difference when comparing the two variants and this one is less complicated. Change-Id: I64a563b209a2444125653777551373cb2989ca7d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7677 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-12-29 r/5541 refactor(tvix/eval): persistent, memory-sharing OrdMap for NixAttrsVincent Ambo9-145/+128
This uses the `im::OrdMap` for `NixAttrs` to enable sharing of memory between different iterations of a map. This slightly speeds up eval, but not significantly. Future work might include benchmarking whether using a `HashMap` and only ordering in cases where order is actually required would help. This switches to a fork of `im` that fixes some bugs with its OrdMap implementation. Change-Id: I2f6a5ff471b6d508c1e8a98b13f889f49c0d9537 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7676 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-12-29 r/5540 refactor(tvix/eval): use im::Vector directly where possibleVincent Ambo3-28/+31
The conversion from im::Vector -> Vec is cheaper for NixList construction (of course), so where possible we should make use of that. This updates most builtins dealing with lists to use Vector directly, and marks the function constructing NixList from Vec as deprecated so that we get appropriate warnings in places where it's still in use. These places are currently inside of JSON serialisation logic which is in flux right now, so lets leave them as-is until it's stabilised. Change-Id: I037f12a2800f2576db4d9526bd935efd079163f0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7671 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-12-29 r/5536 feat(tvix/derivation): serialize Nix DerivationJürgen Hahn22-0/+516
This adds a Derivation structure and allows to write it to a structure that implements std::fmt:Write. The implementation is based on the go-nix version. Change-Id: Ib54e1202b5c67f5d206b21bc109a751e971064cf Reviewed-on: https://cl.tvl.fyi/c/depot/+/7659 Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-29 r/5534 refactor(tvix/eval): use im::Vector for NixList representationVincent Ambo6-44/+206
This is a persistent, structurally sharing data structure which is more efficient in some of our use-cases. I have verified the efficiency improvement using `hyperfine` repeatedly over expressions on nixpkgs. Lists are not the most performance-critical structure in Nix (that would be attribute sets), but we can already see a small (~5-10%) improvement. Note that there are a handful of cases where we still go via `Vec` that need to be fixed, most notable for `builtins.sort` which can not currently be implemented directly using `im::Vector` because of a restrictive type bound. Change-Id: I237cc50cbd7629a046e5a5e4601fbb40355e551d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7670 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-29 r/5533 chore(tvix/store): address clippy warningsFlorian Klink2-18/+15
The only warnings left are unused warnings, but that'll change once we have a real implementation, and not just tests. Change-Id: I28912281b5e66735be37e999cc8ef4b8b09028fb Reviewed-on: https://cl.tvl.fyi/c/depot/+/7669 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-29 r/5532 chore(tvix/store): trim Cargo.tomlFlorian Klink3-6/+9
lazy_static is only used in tests, and anyhow isn't used at all (yet). This can be dropped. Change-Id: Ic41ff3f9bb93cfa600c3485e85464f78a3976504 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7668 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-29 r/5531 chore(tvix/store): move tests into separate fileFlorian Klink3-289/+288
Move them from the bottom of src/proto.rs to its own src/tests/mod.rs. Also drop the test_ prefix, this is not golang. Change-Id: I2e0b6b9812264f3d9721c0766936f08157fadc66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7667 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-12-29 r/5530 docs(tvix/eval): sketch in place list/attr set update ideasterni1-0/+24
Change-Id: Ic7debbd8cbd3acdf5f3947288f2aa2964bd163a0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7660 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-12-28 r/5528 feat(tvix/store/protos): rename Get to Read, add Stat methodFlorian Klink3-88/+434
Stat exposes metadata about a given blob, such as more granular chunking, baos. It implicitly allows checking for existence too, as asking this for a non-existing Blob will return a Status::not_found grpc error. The previous version returned a Status::not_found error on the Get request too, but there was no chance to prevent the server from starting to stream (except sending an immediate cancellation). Being able to check whether something exists in a BlobStore helps to prevent from uploading in first place. The granular chunking bits are an optional optimization - if the BlobStore implements no more granular chunking, the Stat response can simply contain a single chunk. Read returns a stream of BlobChunk, which is just a stream of bytes - not necessarily using the chunking that's returned in the reply of a Stat() call. It can be used to read blobs or chunks. Change-Id: I4b6030ef184ace5484c84ca273b49d710433731d Reviewed-on: https://cl.tvl.fyi/c/depot/+/7652 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-28 r/5527 feat(tvix/store): make blobstore stream chunksFlorian Klink3-172/+171
This changes the RPC methods to return/consume a stream of chunks, instead of a very big message containing the whole blob, to keep message sizes in manageable sizes (less than 4MiB). Change-Id: I2a3a50f07b059d8a2f5196860254adff98c8a352 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7651 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-28 r/5526 feat(tvix): add evans to shellFlorian Klink1-0/+1
Change-Id: I7ec8bae236330ec1e38e82da67b47aef2815d4b6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7437 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-28 r/5525 chore(tvix/store/protos): add PathInfoService::CalculateNAR()Florian Klink3-39/+222
Expose the NAR calculation to a separate `CalculateNAR` method, which responds with the NAR size and sha256 hash. Contrary to what cl/7618 and cl/7620 initially did, don't add different other request types. In the CalculateNARResponse message, there's now some duplication in the (optional) `narinfo` field of a PathInfo, but I'm not entirely sure if we want to drop the fields from there yet. Change-Id: Id797c56e17efedac115fbd43de9dfde9fa1db140 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7663 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-28 r/5524 chore(tvix/store/protos): drop non-sha256 NAR hashesFlorian Klink2-196/+41
Nix actually doesn't support anything else than sha256 NAR hashes, so there's little reason to communicate anything else in here. Co-Authored-By: edef <edef@unfathomable.blue> Change-Id: I760370bd6cabd02028e001a74c454ef9296eb600 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7619 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-12-28 r/5523 chore(tvix/store/protos): move (Root)Node into separate messageFlorian Klink2-124/+191
This is gonna get used in another place in a second. Co-Authored-By: edef <edef@unfathomable.blue> Change-Id: I347c11c8d24379628b7ed09d2c90670c576e686a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7617 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>