diff options
author | Florian Klink <flokli@flokli.de> | 2023-09-02T18·16+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-09-04T16·02+0000 |
commit | 3c340b28bdc812b9c13393c9e2bb378ba7dd9ec8 (patch) | |
tree | 9e45299a02c687275dd6bc30913952fb692edd65 /tvix/cli/src/main.rs | |
parent | 428b65584524e03a2f7cf24ed992f143373b3bd3 (diff) |
refactor(tvix/{cli,store}): move TvixStoreIO to tvix-cli crate r/6550
This trait is eval-specific, there's no point in dealing with these things in tvix-store. This implements the EvalIO interface for a Tvix store. The proper place for this glue code (for now) is tvix-cli, which knows about both tvix-store and tvix-eval. There's one annoyance with this move: The `tvix-store import` subcommand previously also used the TvixStoreIO implementation (because it conveniently did what we wanted). Some of this code had to be duplicated, mostly logic to calculate the NAR-based output path and create the PathInfo object. Some, but potentially more of this can be extracted into helper functions in a shared crate, and then be used from both TvixStoreIO in tvix-cli as well as the tvix-store CLI entrypoint. Change-Id: Ia7515e83c1b54f95baf810fbd8414c5521382d40 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9212 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/cli/src/main.rs')
-rw-r--r-- | tvix/cli/src/main.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs index 5a7342e76593..1980ac1731e7 100644 --- a/tvix/cli/src/main.rs +++ b/tvix/cli/src/main.rs @@ -3,6 +3,7 @@ mod errors; mod known_paths; mod refscan; mod tvix_io; +mod tvix_store_io; use std::cell::RefCell; use std::rc::Rc; @@ -17,6 +18,7 @@ use tvix_eval::Value; use tvix_store::blobservice::MemoryBlobService; use tvix_store::directoryservice::MemoryDirectoryService; use tvix_store::pathinfoservice::MemoryPathInfoService; +use tvix_store_io::TvixStoreIO; #[derive(Parser)] struct Args { @@ -80,7 +82,7 @@ fn interpret(code: &str, path: Option<PathBuf>, args: &Args, explain: bool) -> b eval.io_handle = Box::new(tvix_io::TvixIO::new( known_paths.clone(), - tvix_store::TvixStoreIO::new(blob_service, directory_service, path_info_service), + TvixStoreIO::new(blob_service, directory_service, path_info_service), )); // bundle fetchurl.nix (used in nixpkgs) by resolving <nix> to |