@@ -17,11 +17,12 @@ import UnixSignals
1717
1818let deprecatedLoggerLabel = " service-lifecycle-deprecated-method-logger "
1919
20- /// The configuration for the ``ServiceGroup`` .
20+ /// The configuration for the service group .
2121@available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
2222public struct ServiceGroupConfiguration : Sendable {
2323 /// The group's logging configuration.
2424 public struct LoggingConfiguration : Sendable {
25+ /// The keys to use for logging
2526 public struct Keys : Sendable {
2627 /// The logging key used for logging the unix signal.
2728 public var signalKey = " sl-signal "
@@ -36,19 +37,23 @@ public struct ServiceGroupConfiguration: Sendable {
3637 /// The logging key used for logging an error.
3738 public var errorKey = " sl-error "
3839
39- /// Initializes a new ``ServiceGroupConfiguration/LoggingConfiguration/Keys`` .
40+ /// Creates a new set of keys .
4041 public init ( ) { }
4142 }
4243
4344 /// The keys used for logging.
4445 public var keys = Keys ( )
4546
46- /// Initializes a new ``ServiceGroupConfiguration/LoggingConfiguration`` .
47+ /// Creates a new logging configuration .
4748 public init ( ) { }
4849 }
49-
50+
51+ /// A service configuration.
5052 public struct ServiceConfiguration : Sendable {
51- /// The behavior to follow when the service finishes its ``Service/run()`` method via returning or throwing.
53+
54+ /// The behavior to follow when the service finishes running.
55+ ///
56+ /// This describes what the service lifecycle code does when a service's run method returns or throws.
5257 public struct TerminationBehavior : Sendable , CustomStringConvertible {
5358 internal enum _TerminationBehavior {
5459 case cancelGroup
@@ -57,11 +62,15 @@ public struct ServiceGroupConfiguration: Sendable {
5762 }
5863
5964 internal let behavior : _TerminationBehavior
60-
65+
66+ /// Cancel the service group.
6167 public static let cancelGroup = Self ( behavior: . cancelGroup)
68+ /// Gracefully shut down the service group.
6269 public static let gracefullyShutdownGroup = Self ( behavior: . gracefullyShutdownGroup)
70+ /// Ignore the completion of the service.
6371 public static let ignore = Self ( behavior: . ignore)
64-
72+
73+ /// A string representation of the behavior when a service finishes running.
6574 public var description : String {
6675 switch self . behavior {
6776 case . cancelGroup:
@@ -76,17 +85,17 @@ public struct ServiceGroupConfiguration: Sendable {
7685
7786 /// The service to which the initialized configuration applies.
7887 public var service : any Service
79- /// The behavior when the service returns from its ``Service/ run()`` method.
88+ /// The behavior when the service returns from its run method.
8089 public var successTerminationBehavior : TerminationBehavior
81- /// The behavior when the service throws from its ``Service/ run()`` method.
90+ /// The behavior when the service throws from its run method.
8291 public var failureTerminationBehavior : TerminationBehavior
8392
84- /// Initializes a new ``ServiceGroupConfiguration/ServiceConfiguration`` .
93+ /// Initializes a new service configuration .
8594 ///
8695 /// - Parameters:
8796 /// - service: The service to which the initialized configuration applies.
88- /// - successTerminationBehavior: The behavior when the service returns from its ``Service/ run()`` method.
89- /// - failureTerminationBehavior: The behavior when the service throws from its ``Service/ run()`` method.
97+ /// - successTerminationBehavior: The behavior when the service returns from its run method.
98+ /// - failureTerminationBehavior: The behavior when the service throws from its run method.
9099 public init (
91100 service: any Service ,
92101 successTerminationBehavior: TerminationBehavior = . cancelGroup,
@@ -166,7 +175,7 @@ public struct ServiceGroupConfiguration: Sendable {
166175
167176 internal var _maximumCancellationDuration : ( secondsComponent: Int64 , attosecondsComponent: Int64 ) ?
168177
169- /// Initializes a new ``ServiceGroupConfiguration`` .
178+ /// Creates a new service group configuration from the service configurations you provide .
170179 ///
171180 /// - Parameters:
172181 /// - services: The groups's service configurations.
@@ -179,7 +188,7 @@ public struct ServiceGroupConfiguration: Sendable {
179188 self . logger = logger
180189 }
181190
182- /// Initializes a new ``ServiceGroupConfiguration`` .
191+ /// Creates a new service group configuration from service configurations you provide with cancellation and shutdown signals .
183192 ///
184193 /// - Parameters:
185194 /// - services: The groups's service configurations.
@@ -198,7 +207,7 @@ public struct ServiceGroupConfiguration: Sendable {
198207 self . cancellationSignals = cancellationSignals
199208 }
200209
201- /// Initializes a new ``ServiceGroupConfiguration`` .
210+ /// Creates a new service group configuration from services you provide .
202211 ///
203212 /// - Parameters:
204213 /// - services: The groups's services.
@@ -211,7 +220,7 @@ public struct ServiceGroupConfiguration: Sendable {
211220 self . logger = logger
212221 }
213222
214- /// Initializes a new ``ServiceGroupConfiguration`` .
223+ /// Creates a new service group configuration from services you provide with cancellation and shutdown signals. .
215224 ///
216225 /// - Parameters:
217226 /// - services: The groups's services.
@@ -230,6 +239,7 @@ public struct ServiceGroupConfiguration: Sendable {
230239 self . cancellationSignals = cancellationSignals
231240 }
232241
242+ /// Initializes a new service group configuration.
233243 @available ( * , deprecated)
234244 public init ( gracefulShutdownSignals: [ UnixSignal ] ) {
235245 self . services = [ ]
0 commit comments