[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#52555] [RFC PATCH v2 3/5] Add (guix eris).
From: |
Maxime Devos |
Subject: |
[bug#52555] [RFC PATCH v2 3/5] Add (guix eris). |
Date: |
Sat, 29 Jan 2022 22:23:16 +0100 |
User-agent: |
Evolution 3.38.3-1 |
pukkamustard schreef op di 25-01-2022 om 19:21 [+0000]:
> +(define (ipfs-daemon-alive?)
> + "Attempt to connect to the IPFS daemon. Returns #t if the daemon is alive
> +and #f else."
> + (with-exception-handler
> + (const #f)
> + (lambda _
> + (let ((response _
> + (http-post (string-append (%ipfs-base-url)
> + "/api/v0/version"))))
> + (equal? 200 (response-code response))))
> + #:unwind? #t))
This should preferably only be catching exceptions indicating that
the daemon is down (exceptions indicating 404s, or system-errors
indicating network errors, ...).
> +
> +(define guix-eris-block-reducer
> + (case-lambda
> +
> + ;; Check if IPFS Daemon is running.
> + (() (if (ipfs-daemon-alive?)
> + (eris-blocks-ipfs-reducer)
> + #f))
> +
> + ;; Completion. Nothing to do.
> + ((_) #t)
> +
> + ((ipfs ref-block)
> + ;; If IPFS has been initialized store block there
> + (if ipfs
> + (eris-blocks-ipfs-reducer ipfs ref-block)
> + ipfs))))
This (ipfs-daemon-alive?) seems racy, although it's probably not.
Can we do
(define guix-eris-block-reducer
(case-lambda
(() (guard (c (oops-it-fails-because-the-daemon-cannot-be-
contacted? c)
#false)
(eris-block-ipfs-reducer))
[...]))
instead? (I don't think this will work as-is, because from the name and
thunkiness, it would appear that eris-block-ipfs-reducer returns a
procedure ...
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part
- [bug#52555] [RFC PATCH v2 0/5] Decentralized substitute distribution with ERIS, pukkamustard, 2022/01/25
- [bug#52555] [RFC PATCH v2 2/5] publish: Add ERIS URN to narinfo, pukkamustard, 2022/01/25
- [bug#52555] [RFC PATCH v2 3/5] Add (guix eris)., pukkamustard, 2022/01/25
- [bug#52555] [RFC PATCH v2 1/5] WIP: gnu: guile-eris: Update to unreleased git version., pukkamustard, 2022/01/25
- [bug#52555] [RFC PATCH v2 5/5] substitute: Fetch substitutes using ERIS., pukkamustard, 2022/01/25
- [bug#52555] [RFC PATCH v2 4/5] publish: Add support for storing ERIS encoded blocks to IPFS., pukkamustard, 2022/01/25