From: attila.lendvai@gmail.com
To: guix-devel@gnu.org
Cc: Attila Lendvai <attila@lendvai.name>
Subject: [PATCH shepherd] service: Rename to QUERY-SERVICE-CONTROLLER and use CUT.
Date: Sun, 30 Jun 2024 18:13:01 +0200 [thread overview]
Message-ID: <20240630161303.22507-4-attila@lendvai.name> (raw)
In-Reply-To: <20240630161303.22507-2-attila@lendvai.name>
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
next prev parent reply other threads:[~2024-06-30 17:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-30 16:12 [PATCH shepherd] service: Add custom printer for <service> attila.lendvai
2024-06-30 16:13 ` attila.lendvai [this message]
2024-06-30 16:13 ` [PATCH shepherd] service: Factor out SEND-TO-PROCESS-MONITOR attila.lendvai
2024-06-30 16:13 ` [PATCH shepherd] service: Factor out SEND-TO-REGISTRY attila.lendvai
2024-06-30 16:13 ` [PATCH shepherd] service: Factor out SEND-TO-SERVICE-CONTROLLER attila.lendvai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240630161303.22507-4-attila@lendvai.name \
--to=attila.lendvai@gmail.com \
--cc=attila@lendvai.name \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.