guix-devel
[Top][All Lists]
Advanced

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

Re: 04/07: inferior: Break cached-channel-instance into two procedures.


From: Ludovic Courtès
Subject: Re: 04/07: inferior: Break cached-channel-instance into two procedures.
Date: Wed, 10 Mar 2021 10:57:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi Mathieu!

guix-commits@gnu.org skribis:

> commit 7d63b775513e7049047222dbe403a4181f63828d
> Author: Mathieu Othacehe <othacehe@gnu.org>
> AuthorDate: Fri Mar 5 09:51:42 2021 +0100
>
>     inferior: Break cached-channel-instance into two procedures.
>     
>     Break cached-channel-instance into two different procedures:
>     channels->cached-profile and instances->cached-profile operating 
> respectively
>     on channels and channels instances.
>     
>     * guix/inferior.scm (cached-channel-instance): Rename it into ...
>     (cached-profile): ... this new procedure.
>     (channels->cached-profile, instances->cached-profile): New procedures.
>     * guix/scripts/time-machine.scm (guix-time-machine): Adapt accordingly.

[...]

> -(define* (cached-channel-instance store
> -                                  channels
> -                                  #: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."
> -  (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))
> -
> +(define* (cached-profile store instances
> +                         #:key
> +                         cache-directory
> +                         commits ttl)
> +  "Return a directory containing a guix filetree defined by INSTANCES, a
> +procedure returning a list of 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."

We need to keep ‘cached-channel-instance’ because it’s part of the
public API and used outside Guix (in Guix-Jupyter at least).  We can use
‘define-deprecated’.

Also, I think ‘cached-profile’ doesn’t quite capture what this is
about.  :-)  The docstring should mention what COMMITS is.  The fact
that INSTANCES is a thunk is a bit awkward and IMO not great for a
public interface.

WDYT?

Thanks,
Ludo’.



reply via email to

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