guix-devel
[Top][All Lists]
Advanced

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

[PATCH shepherd] service: Rename to QUERY-SERVICE-CONTROLLER and use CUT


From: attila . lendvai
Subject: [PATCH shepherd] service: Rename to QUERY-SERVICE-CONTROLLER and use CUT.
Date: Sun, 30 Jun 2024 18:13:01 +0200

From: Attila Lendvai <attila@lendvai.name>

* 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




reply via email to

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