From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 0Kt3NHKagWazlgAAe85BDQ:P1 (envelope-from ) for ; Sun, 30 Jun 2024 17:48:35 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 0Kt3NHKagWazlgAAe85BDQ (envelope-from ) for ; Sun, 30 Jun 2024 19:48:34 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HHO01Qrn; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1719769714; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=pEWpxtwKwlrcj6EcmCCSLID5ZfCldIAKPP+clgBy+7E=; b=sWrXgnUOwDmTIQDQZTIrnefUmtf+/Rpj403pFBBo8DOTUmIiqs4swQT6j68HhNcS95RgnG W0ryRMEF60d550LFfLrlEexq95UluQuaQCS++melG3oavxlNe7shd4qorRTYmnua7SD9nm 2Wwltgm++QRAWi7HTBSqZP7hB8P30zp507kBTocVEByA7X1oMlHBG1W3iQpJcu78mU7QGG kfenz0Itqv6v97AV+YID6fp7tHkGo/O2EWPpXjampuwueyKdcv/pANoKVzb3aNCv44Mdgs ymUc2fjLcaA4UUHEBaRjKsjj0ZWUF1QFgpKmDX6vxbUgYsNbOxayXsGqbFoTjg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=HHO01Qrn; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1719769714; a=rsa-sha256; cv=none; b=AvjDCMjUMtv3aJFBzzEkZEtfZcmRmn9s04P9ZEZ7YsmuliBCB4OyahpgUy/sB2K98jZung RNSjF3vcV6vtfilhKf58uTDFQYi/N5MkeFB7itZGdBZ+Ggzcdhv04S7YO4JczAVdIQsFAt JtxvD76qvy/f5XAPQmwv0+7M9Lhx/vPlwf3nPZc2PvEUyHu6vHdeJI5uSbJi2ovhyp9zyP lTV7cEdJWFeu+EUXjbeIkQQnZFkRUwYf4IgB5PpOBjMMHYzb6lubFNIIZD0vM1FfGzFBID MglVlct3t5PUDrzRhy6BBEWvV6Bv8YCybs4/KCXxwgjODodIwT6fS4LJw/XzEg== 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 9A1A7D42F for ; Sun, 30 Jun 2024 19:48:34 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNyee-0001fT-FM; Sun, 30 Jun 2024 13:48:00 -0400 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 1sNxCi-0005Cz-OH for guix-devel@gnu.org; Sun, 30 Jun 2024 12:15:04 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNxCg-0004ul-Ox for guix-devel@gnu.org; Sun, 30 Jun 2024 12:15:04 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-57d15b85a34so2380817a12.3 for ; Sun, 30 Jun 2024 09:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719764101; x=1720368901; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pEWpxtwKwlrcj6EcmCCSLID5ZfCldIAKPP+clgBy+7E=; b=HHO01QrnzHX8KG19l5SgHzmTIeNX+t39E7/zMqvMwJ5og0nOGuTuLEEL/v2xn7PUbS Cw5Z1MZlwQ+mJ6RvaB2eOck2F8N3qtRooUyYd+Rz2Bb7YTjVFFcL8moIjmcIBPmTKSg5 mM09RWf53NFkJmXV+IlzEOK0OGcvR6Am3bQlrHOr36Tk0FLAQU+dyRbGPzySqonZaBzK wBBGwEA7BkPnqckHjjzCQpPv+vPF5Y6z++5Cls2nC0DDqlWUniIpk5MUQPl0vHnIerLg Rcc8Uu3TgCCsCa6Njw5S4MSMbh7o+gg1w9kkkCmkRSOAK3oTzJOCx9/vsDdKfGbDH0A2 j2KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719764101; x=1720368901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pEWpxtwKwlrcj6EcmCCSLID5ZfCldIAKPP+clgBy+7E=; b=YTdRWgwVMrb47VrT2V1cMZFkkrpXXy+d0uzKbjU76c45aNiflEXLn3Gy7Y3Ch+f5l0 wnJ8XWhlacZuc+hsmXbxiJsIIHaKl/DIPhH51tNutg+IpiXhPKHNiYzYSp1tD/HLvBH/ /rurny4syLD3ibYAHy0IYKWRELo6e6o6KkYq0CDZoOIW9df99UL/C//3L2Q6Y/CSxbol 9qRbsS9KijV9MqIwraxGDKNL1pBphutrrTI8rbauGqLbeJpXewT3phjvJEAdt0qofFqU 2OA6QspYHLkbUP1qBomajSyID0FYKLqbwkBmIqlpA5S/ZQdyqhyXb/IH5hOlny0SjoS/ d5dQ== X-Gm-Message-State: AOJu0YwaHjSgWBjjtCB8Onz2gJB2VHYOLFMacdoqT83xUGV3w29S0+5h RngKnINVB/UUEcZ/USz7sgEVFu0lyb8nEvtpWRGUJim3OugaEqjK837iMg== X-Google-Smtp-Source: AGHT+IHWnXSbZi0fZ8yMpCPmj8c1sWSinQlbx15IHiUGkadZXxhGDhbzZR6zgnv8/0pSeBI58snX4w== X-Received: by 2002:a17:906:d930:b0:a6f:5723:fb11 with SMTP id a640c23a62f3a-a7514495948mr203238266b.58.1719764101264; Sun, 30 Jun 2024 09:15:01 -0700 (PDT) Received: from lelap.lan (2a00-1f40-b161-2920--477.pool6.panelnet.hu. [2a00:1f40:b161:2920::477]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf1bc08sm252509666b.28.2024.06.30.09.15.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jun 2024 09:15:01 -0700 (PDT) From: attila.lendvai@gmail.com X-Google-Original-From: attila@lendvai.name To: guix-devel@gnu.org Cc: Attila Lendvai Subject: [PATCH shepherd] service: Rename to QUERY-SERVICE-CONTROLLER and use CUT. Date: Sun, 30 Jun 2024 18:13:01 +0200 Message-ID: <20240630161303.22507-4-attila@lendvai.name> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240630161303.22507-2-attila@lendvai.name> References: <20240630161303.22507-2-attila@lendvai.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=attila.lendvai@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 30 Jun 2024 13:47:43 -0400 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -9.22 X-Migadu-Queue-Id: 9A1A7D42F X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -9.22 X-TUID: JA9tNTn9nZSd From: Attila Lendvai * modules/shepherd/service.scm (query-service-controller): New function based on the previous SERVICE-CONTROL-MESSAGE. Use CUT instead of the now deleted SERVICE-CONTROL-MESSAGE. (service-control-message): Deleted. --- modules/shepherd/service.scm | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm index b018e39..d9dc0d5 100644 --- a/modules/shepherd/service.scm +++ b/modules/shepherd/service.scm @@ -776,55 +776,54 @@ wire." "Return the \"canonical\" name of @var{service}." (car (service-provision service))) -(define (service-control-message message) - "Return a procedure to send @var{message} to the given service's control -channel and wait for its reply." - (lambda (service) - (let ((reply (make-channel))) - (put-message (service-control service) (list message reply)) - (get-message reply)))) +(define (query-service-controller service message) + "Send @var{message} to the service's control channel of @var{message} and +wait for its reply." + (let ((reply (make-channel))) + (put-message (service-control service) (list message reply)) + (get-message reply))) (define service-running-value ;; Return the "running value" of @var{service}. - (service-control-message 'running)) + (cut query-service-controller <> 'running)) (define service-status ;; Return the status of @var{service}, one of @code{stopped}, ;; @code{starting}, @code{running}, or @code{stopping}. - (service-control-message 'status)) + (cut query-service-controller <> 'status)) (define service-respawn-times ;; Return the list of respawn times of @var{service}. - (service-control-message 'respawn-times)) + (cut query-service-controller <> 'respawn-times)) (define service-startup-failures ;; Return the list of recent startup failure times for @var{service}. (compose ring-buffer->list - (service-control-message 'startup-failures))) + (cut query-service-controller <> 'startup-failures))) (define service-status-changes ;; Return the list of symbol/timestamp pairs representing recent state ;; changes for @var{service}. (compose ring-buffer->list - (service-control-message 'status-changes))) + (cut query-service-controller <> 'status-changes))) (define service-process-exit-statuses ;; Return the list of last exit statuses of @var{service}'s main process ;; (most recent first). (compose ring-buffer->list - (service-control-message 'exit-statuses))) + (cut query-service-controller <> 'exit-statuses))) (define service-enabled? ;; Return true if @var{service} is enabled, false otherwise. - (service-control-message 'enabled?)) + (cut query-service-controller <> 'enabled?)) (define service-replacement ;; Return the replacement of @var{service}, #f if there is none. - (service-control-message 'replacement)) + (cut query-service-controller <> 'replacement)) (define service-logger ;; Return the logger of @var{service}, #f if there is none. - (service-control-message 'logger)) + (cut query-service-controller <> 'logger)) (define (service-recent-messages service) "Return the list of recent messages logged for @var{service}." -- 2.45.2