From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MMbEJlvkrWPhrAAAbAwnHQ (envelope-from ) for ; Thu, 29 Dec 2022 20:02:51 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oGTzJVvkrWMKvAAAG6o9tA (envelope-from ) for ; Thu, 29 Dec 2022 20:02:51 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5E2361ABD0 for ; Thu, 29 Dec 2022 20:02:51 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAxQt-0000Eh-AL; Thu, 29 Dec 2022 13:15:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAxQm-0000BK-D6 for guix-patches@gnu.org; Thu, 29 Dec 2022 13:15:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAxQm-0004Dz-3F for guix-patches@gnu.org; Thu, 29 Dec 2022 13:15:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pAxQl-0007Rm-U2 for guix-patches@gnu.org; Thu, 29 Dec 2022 13:15:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52555] [PATCH v3 7/8] eris: Use parameterized %eris-peers when getting blocks. Resent-From: pukkamustard Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 29 Dec 2022 18:15:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52555 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52555@debbugs.gnu.org Cc: pukkamustard Received: via spool by 52555-submit@debbugs.gnu.org id=B52555.167233767828517 (code B ref 52555); Thu, 29 Dec 2022 18:15:03 +0000 Received: (at 52555) by debbugs.gnu.org; 29 Dec 2022 18:14:38 +0000 Received: from localhost ([127.0.0.1]:32812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAxQL-0007Pm-No for submit@debbugs.gnu.org; Thu, 29 Dec 2022 13:14:38 -0500 Received: from mout02.posteo.de ([185.67.36.66]:48273) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pAxQE-0007OO-Cy for 52555@debbugs.gnu.org; Thu, 29 Dec 2022 13:14:31 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id DB00B2401E3 for <52555@debbugs.gnu.org>; Thu, 29 Dec 2022 19:14:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1672337664; bh=0t3VJ7QgKBL8gGBqmmcrMOnEDnoXjqRl59gNRajS6t0=; h=From:To:Cc:Subject:Date:From; b=U/q3HYZOys4d1YBYzUtEZlljzp+hqeMAqPiQLTzdDE9pXf/uBTN03ug5BDGu8NGF2 Ldzki+Ii9Tfqp3ARCb8x/TG76OEhcPlVNONebJap9BSn1GGlZK0GEqd5KoPu34BDo8 QMPEvM0AbwRABqRGehvtRkXNbmMo04jaNUDvEWnWgjhZ/ed6qVPEZ4ETQPXl03jzHc noCHXXMwAQAMA+ksjxaeGfxqrmJMcREri1PxlNOkAqzZFG9HBTw/NrBuJWGN4xRCbu zzhB//HNFmwoAurcy60M3cSS/DstFAE30P+vn+l/4CcExmVxjj5vgRtY02JYNjsc9J 9ycM2TUuSHbLg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Njc3h1JwQz6tnW; Thu, 29 Dec 2022 19:14:24 +0100 (CET) From: pukkamustard Date: Thu, 29 Dec 2022 18:13:26 +0000 Message-Id: <20221229181327.758-8-pukkamustard@posteo.net> In-Reply-To: <20221229181327.758-1-pukkamustard@posteo.net> References: <20221229181327.758-1-pukkamustard@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1672340571; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=isJLaHgahtcNqKOezzbuAHJ5iwGSng76BKYgBHh1CWg=; b=V6fjhMzodMdQqgAQ3Y9316208uOipuBONj4HGJRozYfL+D0eQdeGQhyi4TkOF1c1HG0VuB x/8Ezza2COrRRQoG6ddOrnjAKqXAe0KmjhTWpVMLneYNbGfRD6bMNtqySgtlAdqCdF+dZc ScEdx5pTUXL4hiqH7IWWKlQ/ceDEGpAfnK6E/NkjuJwsF0AjfXL++xEJfLJm7U2xsx5ZCi lSMnk+7kGajtdNQzVq5MKO8ugplbLahsNom3MF4MsKdzSeoapmpCzob44G1Ox0Tn1oXAX5 16HdlQjrmJymZMqpWUhJgB9hLGesEZivs8GpDctNVVSzpwnsQXA2pCtesof9HQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b="U/q3HYZO"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1672340571; a=rsa-sha256; cv=none; b=bjuIhEmmDjCkPDU93Qv7dUGREAFoFjf1+hsZjIe2WXQLytLJwow7UvnbKOwuzRhlbp2CEU Mg8mAJIQBsMHHzxH8qVezseZS83b0eUIKmbJHaB4VeMa2UoaSO2FCWIpa+VcJSoYfTmdem WUWM73c88cOtpBOR9A2qu1gb83BGm2pbKaJg+Pl2bSbb+e6rzKNvZvZ0XFulRaIlX8q1Wm 2jk3MOYtJr2NgP1902xikiYdafjwCTra8++c36++oc/QG68iLyuarQfQbpvtyfnO8LJZ2+ Esh+kP3sawYbg7SzZUtuqxNfBiRcqUEiyOwp/n+18qm3MUlTQMdFjWR1MqIXIQ== X-Spam: Yes X-Migadu-Queue-Id: 5E2361ABD0 X-Migadu-Spam: Yes X-Spam-Score: 8.77 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b="U/q3HYZO"; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none) X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: 8.77 X-TUID: A4R/vc07DvBA --- 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