[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#52555] [PATCH v3 7/8] eris: Use parameterized %eris-peers when gett
From: |
pukkamustard |
Subject: |
[bug#52555] [PATCH v3 7/8] eris: Use parameterized %eris-peers when getting blocks. |
Date: |
Thu, 29 Dec 2022 18:13:26 +0000 |
---
guix/eris.scm | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/guix/eris.scm b/guix/eris.scm
index 4af17c2807..d56643bec4 100644
--- a/guix/eris.scm
+++ b/guix/eris.scm
@@ -54,15 +54,30 @@ (define* (try-in-order ref #:key block-refs)
(try-in-order ref #:block-refs rest))))
(() #f)))
+(define* (peer->block-ref peer #:key open-connection)
+ (case (uri-scheme peer)
+
+ ((http https)
+ (lambda (ref)
+ (eris-http-block-ref ref
+ #:host peer
+ #:open-connection open-connection)))
+
+ ;; unsupported ERIS peer URL
+ (else (lambda (_) #f))))
+
(define* (guix-eris-block-ref ref #:key open-connection)
(try-in-order
ref
#:block-refs
- (list
+ (cons
+
+ ;; first try and get block from local block store
(lambda (ref)
(eris-fs-store-ref ref
#:store-directory (%eris-block-store-directory)))
- (lambda (ref)
- (eris-http-block-ref ref
- #:host (string->uri "http://localhost:8081")
- #:open-connection open-connection)))))
+
+ ;; then try peers
+ (map (lambda (peer)
+ (peer->block-ref peer #:open-connection open-connection))
+ (%eris-peers)))))
--
2.38.1
- [bug#52555] [PATCH v3 0/8] Decentralized substitute distribution with ERIS, pukkamustard, 2022/12/29
- [bug#52555] [PATCH v3 2/8] publish: Store ERIS encoded blocks to a local block store., pukkamustard, 2022/12/29
- [bug#52555] [PATCH v3 1/8] publish: Add ERIS URN to narinfo., pukkamustard, 2022/12/29
- [bug#52555] [PATCH v3 3/8] publish: Add HTTP endpoint for resolving ERIS blocks., pukkamustard, 2022/12/29
- [bug#52555] [PATCH v3 4/8] WIP: substitute: Fetch substitutes using ERIS., pukkamustard, 2022/12/29
- [bug#52555] [PATCH v3 5/8] eris/http: Add HTTP block de-referencer., pukkamustard, 2022/12/29
- [bug#52555] [PATCH v3 8/8] eris: Use IPFS to get ERIS blocks., pukkamustard, 2022/12/29
- [bug#52555] [PATCH v3 7/8] eris: Use parameterized %eris-peers when getting blocks.,
pukkamustard <=
- [bug#52555] [PATCH v3 6/8] WIP: eris: Use HTTP to get ERIS blocks., pukkamustard, 2022/12/29