guix-devel
[Top][All Lists]
Advanced

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

The “binary cache” format


From: Ludovic Courtès
Subject: The “binary cache” format
Date: Fri, 07 Feb 2014 14:02:07 +0100
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Hello,

We were discussing on IRC about the “binary cache” format (in Nix
parlance) that Hydra uses, and that ‘guix substitute-binary’ expects.

Basically a “binary cache” HTTP server is expected to serve three kinds
of files:

  • The ‘nix-cache-info’ file contains two recutils-style fields, saying
    what its store directory is (e.g., “/nix/store”) and whether it
    accepts mass queries (IOW, whether ‘guix substitute-binary’ should
    use a bunch of threads to make HTTP queries in parallel.)

  • For each substitutable store item, it serves a HASH.narinfo file,
    which contains recutils-formatted meta-data about the corresponding
    substitute: URL and size of the substitute, compression format, etc.

  • Each substitutable store item is served as a ‘.nar’ file–an archive
    as created by ‘write-file’ in (guix nar).

An example of these three things is the “substitute” test in
tests/store.scm.  If creates these three kinds of files in the very same
format that Hydra does.

Now, in addition, ‘guix substitute-binary’ caches .narinfo lookups
locally, to reduce the amount of HTTP requests [0].  This cache is
typically under /var/nix/substitute-binary/cache.  That directory
contains one file per looked up substitute.  Each file is an
s-expression that contains a time-stamp, and either #f (if the
substitute lookup was negative), or the .narinfo in a string (if the
substitute lookup was positive.)

This caching can be seen in ‘lookup-narinfo’, in substitute-binary.scm.
But note that this cache and its file format is something internal to
‘guix substitute-binary’, and must not be confused with the “binary
cache” format produced by Hydra.

HTH!

Ludo’.

[0] https://lists.gnu.org/archive/html/bug-guix/2013-04/msg00082.html



reply via email to

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