guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#46776] [PATCH] inferior: Extend cached-channel-instance scope.


From: Ludovic Courtès
Subject: [bug#46776] [PATCH] inferior: Extend cached-channel-instance scope.
Date: Mon, 01 Mar 2021 15:47:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi,

Mathieu Othacehe <othacehe@gnu.org> skribis:

> * guix/inferior.scm (cached-channel-instance): Turn channels argument into
> channels-or-instances.  Adapt the rest of the procedure.

[...]

>  (define* (cached-channel-instance store
> -                                  channels
> +                                  channels-or-instances
>                                    #:key
>                                    (authenticate? #t)
>                                    (cache-directory 
> (%inferior-cache-directory))
>                                    (ttl (* 3600 24 30)))
> -  "Return a directory containing a guix filetree defined by CHANNELS, a list 
> of channels.
> -The directory is a subdirectory of CACHE-DIRECTORY, where entries can be 
> reclaimed after TTL seconds.
> -This procedure opens a new connection to the build daemon.  AUTHENTICATE?
> -determines whether CHANNELS are authenticated."
> +  "Return a directory containing a guix filetree defined by
> +CHANNELS-OR-INSTANCES, a list of channels or channel instances.  The 
> directory
> +is a subdirectory of CACHE-DIRECTORY, where entries can be reclaimed after 
> TTL
> +seconds.  This procedure opens a new connection to the build daemon.
> +AUTHENTICATE?  determines whether CHANNELS are authenticated."
> +  ;; Determine if we are dealing with channels or channel instances.
> +  (define channels?
> +    (match (pk channels-or-instances)
> +      (((? channel? c) rest ...)
> +       #t)
> +      (else #f)))
> +
>    (define commits
>      ;; Since computing the instances of CHANNELS is I/O-intensive, use a
>      ;; cheaper way to get the commit list of CHANNELS.  This limits overhead
>      ;; to the minimum in case of a cache hit.
> -    (map channel-full-commit channels))
> +    (if channels?
> +      (map channel-full-commit channels-or-instances)
> +      (map channel-instance-commit channels-or-instances)))

This would only accept homogeneous lists, which is kinda weird.

Could we instead have a separate procedure taking channel instances, and
arrange to factorize common code in a third procedure?

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]