[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 09/12: service: Rename "service monitor" to "service registry
From: |
Ludovic Courtès |
Subject: |
[shepherd] 09/12: service: Rename "service monitor" to "service registry". |
Date: |
Sun, 19 Feb 2023 16:58:37 -0500 (EST) |
civodul pushed a commit to branch wip-service-monitor
in repository shepherd.
commit 55a2754454a626185575d7a0b19741083b58a3f8
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Feb 19 16:23:11 2023 +0100
service: Rename "service monitor" to "service registry".
* modules/shepherd/service.scm (current-monitor-channel): Rename to...
(current-registry-channel): ... this. Update users.
(service-monitor): Rename to...
(service-registry): ... this. Update users.
(spawn-service-monitor): Rename to...
(spawn-service-registry): ... this. Update user.
(call-with-service-monitor): Rename to...
(call-with-service-registry): ... this. Update user.
(with-service-monitor): Rename to...
(with-service-registry): ... this. Update users.
---
.dir-locals.el | 2 +-
modules/shepherd.scm | 2 +-
modules/shepherd/service.scm | 36 ++++++++++++++++++------------------
3 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/.dir-locals.el b/.dir-locals.el
index ad0c232..d4cfc6b 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -13,6 +13,6 @@
. ((indent-tabs-mode . nil)
(eval . (put 'with-blocked-signals 'scheme-indent-function 1))
(eval . (put 'with-process-monitor 'scheme-indent-function 0))
- (eval . (put 'with-service-monitor 'scheme-indent-function 0))))
+ (eval . (put 'with-service-registry 'scheme-indent-function 0))))
(texinfo-mode . ((indent-tabs-mode . nil)
(fill-column . 72))))
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 3332e08..2949f77 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -411,7 +411,7 @@ already ~a threads running, disabling 'signalfd' support")
;; because POSIX threads and 'fork' cannot be used together.
(run-fibers
(lambda ()
- (with-service-monitor
+ (with-service-registry
;; Register and start the 'root' service.
(register-services root-service)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index ed0766a..a586a21 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -57,7 +57,7 @@
action-list
lookup-action
defines-action?
- with-service-monitor
+ with-service-registry
action?
@@ -597,7 +597,7 @@ that could not be started."
completely removes all references to OLD-SERVICE before registering
NEW-SERVICE."
(when new-service
- (put-message (current-monitor-channel)
+ (put-message (current-registry-channel)
`(unregister ,(list old-service)))
(register-services new-service)))
@@ -679,7 +679,7 @@ is not already running, and will return SERVICE's canonical
name in a list."
name))
(when (transient? service)
- (put-message (current-monitor-channel)
+ (put-message (current-registry-channel)
`(unregister ,(list service)))
(local-output (l10n "Transient service ~a unregistered.")
(canonical-name service)))
@@ -839,10 +839,10 @@ clients."
;;;
-;;; Service monitor.
+;;; Service registry.
;;;
-(define (service-monitor channel)
+(define (service-registry channel)
"Encapsulate shepherd state (registered and running services) and serve
requests arriving on @var{channel}."
(define (stopped? service)
@@ -919,30 +919,30 @@ requests arriving on @var{channel}."
names))
(loop registered))))))
-(define (spawn-service-monitor)
+(define (spawn-service-registry)
"Spawn a new service monitor fiber and return a channel to send it requests."
(define channel
(make-channel))
(spawn-fiber
(lambda ()
- (service-monitor channel)))
+ (service-registry channel)))
channel)
-(define current-monitor-channel
+(define current-registry-channel
;; The channel to communicate with the current service monitor.
(make-parameter #f))
-(define (call-with-service-monitor thunk)
- (parameterize ((current-monitor-channel (spawn-service-monitor)))
+(define (call-with-service-registry thunk)
+ (parameterize ((current-registry-channel (spawn-service-registry)))
(thunk)))
-(define-syntax-rule (with-service-monitor exp ...)
+(define-syntax-rule (with-service-registry exp ...)
"Spawn a new service monitor and evaluate @var{exp}... within that dynamic
extent.
This allows @var{exp}... and their callees to send requests to delegate
service state and to send requests to the service monitor."
- (call-with-service-monitor (lambda () exp ...)))
+ (call-with-service-registry (lambda () exp ...)))
@@ -2049,7 +2049,7 @@ Return #f if service is not found."
(lambda (proc init)
"Apply PROC to the registered services to build a result, and return that
result. Works in a manner akin to `fold' from SRFI-1."
- (put-message (current-monitor-channel)
+ (put-message (current-registry-channel)
`(service-list ,reply))
(fold (match-lambda*
(((name . services) result)
@@ -2087,7 +2087,7 @@ returned in unspecified."
(let ((reply (make-channel)))
(lambda (name)
"Return a (possibly empty) list of services that provide NAME."
- (put-message (current-monitor-channel) `(lookup ,name ,reply))
+ (put-message (current-registry-channel) `(lookup ,name ,reply))
(get-message reply))))
(define waitpid*
@@ -2275,7 +2275,7 @@ then disable it."
(slot-set! serv 'enabled? #f)
(when (transient? serv)
- (put-message (current-monitor-channel) `(unregister (,serv)))
+ (put-message (current-registry-channel) `(unregister (,serv)))
(local-output (l10n "Transient service ~a terminated, now
unregistered.")
(canonical-name serv))))))
@@ -2290,7 +2290,7 @@ is currently stopped, replace it immediately."
(assert (list-of-symbols? (required-by new)))
(assert (boolean? (respawn? new)))
- (put-message (current-monitor-channel) `(register ,new)))
+ (put-message (current-registry-channel) `(register ,new)))
(for-each register-single-service new-services))
@@ -2306,13 +2306,13 @@ requested to be removed."
(when (running? service)
(stop service))
;; Remove services provided by service from the hash table.
- (put-message (current-monitor-channel)
+ (put-message (current-registry-channel)
`(unregister ,(list service))))
(let ((name (string->symbol service-name)))
(cond ((eq? name 'all)
;; Special 'remove all' case.
- (put-message (current-monitor-channel) `(unregister-all))
+ (put-message (current-registry-channel) `(unregister-all))
#t)
(else
;; Removing only one service.
- [shepherd] branch wip-service-monitor created (now da158c5), Ludovic Courtès, 2023/02/19
- [shepherd] 01/12: service: Remove 'stop-delay?' and 'waiting-for-termination?'., Ludovic Courtès, 2023/02/19
- [shepherd] 02/12: service: Handle service state in a monitoring agent., Ludovic Courtès, 2023/02/19
- [shepherd] 06/12: service: 'stop' blocks when a service is already being stopped., Ludovic Courtès, 2023/02/19
- [shepherd] 09/12: service: Rename "service monitor" to "service registry".,
Ludovic Courtès <=
- [shepherd] 10/12: service: Clarify expected statuses., Ludovic Courtès, 2023/02/19
- [shepherd] 05/12: service: 'start-in-the-background' starts services in parallel., Ludovic Courtès, 2023/02/19
- [shepherd] 03/12: service: 'start' blocks when a service is already being started., Ludovic Courtès, 2023/02/19
- [shepherd] 04/12: service: Start dependent services in parallel., Ludovic Courtès, 2023/02/19
- [shepherd] 07/12: service: 'service-running-value' uses a fresh channel for each reply., Ludovic Courtès, 2023/02/19
- [shepherd] 11/12: service: Communicate the service status symbol to clients., Ludovic Courtès, 2023/02/19
- [shepherd] 12/12: herd: Report 'starting' and 'stopping' service statuses., Ludovic Courtès, 2023/02/19
- [shepherd] 08/12: service: Associate a control fiber with each service., Ludovic Courtès, 2023/02/19