From c7c7f068c15e419aaf5ef616516aa5ad4e55c2fa Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 14 Dec 2020 17:59:32 +0100 Subject: daemon: Delegate deduplication to 'guix substitute'. This removes the main source of latency between subsequent downloads. * nix/libstore/build.cc (SubstitutionGoal::tryToRun): Add a "deduplicate" key to ENV. (SubstitutionGoal::finished): Remove call to 'optimisePath'. * guix/scripts/substitute.scm (process-substitution)[destination-in-store?] [dump-file/deduplicate*]: New variables. Pass #:dump-file to 'restore-file'. * guix/scripts/substitute.scm (guix-substitute)[deduplicate?]: New variable. Pass #:deduplicate? to 'process-substitution'. * guix/serialization.scm (dump-file): Export and augment 'dump-file'. --- guix/serialization.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'guix/serialization.scm') diff --git a/guix/serialization.scm b/guix/serialization.scm index 9e2dce8bb0..59cd93fb18 100644 --- a/guix/serialization.scm +++ b/guix/serialization.scm @@ -51,7 +51,8 @@ write-file write-file-tree fold-archive - restore-file)) + restore-file + dump-file)) ;;; Comment: ;;; @@ -458,7 +459,10 @@ depends on TYPE." (&nar-read-error (port port) (file file) (token x))))))))) (define (dump-file file input size type) - "Dump SIZE bytes from INPUT to FILE." + "Dump SIZE bytes from INPUT to FILE. + +This procedure is suitable for use as the #:dump-file argument to +'restore-file'." (call-with-output-file file (lambda (output) (dump input output size)))) -- cgit v1.2.3