Skip to content

Commit 94c1e1c

Browse files
committed
adding abstracts and organization to methods
1 parent e718730 commit 94c1e1c

File tree

4 files changed

+48
-7
lines changed

4 files changed

+48
-7
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ``ServiceLifecycle/ServiceGroup``
2+
3+
## Topics
4+
5+
### Creating a service group
6+
7+
- ``init(configuration:)``
8+
- ``init(services:gracefulShutdownSignals:cancellationSignals:logger:)``
9+
- ``init(services:configuration:logger:)``
10+
11+
### Adding to a service group
12+
13+
- ``addServiceUnlessShutdown(_:)-r47h``
14+
- ``addServiceUnlessShutdown(_:)-(Service)``
15+
16+
### Running a service group
17+
18+
- ``run(file:line:)``
19+
- ``run()``
20+
- ``triggerGracefulShutdown()``

Sources/ServiceLifecycle/Docs.docc/index.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,17 @@ let package = Package(
7676

7777
- ``ServiceGroup``
7878
- ``ServiceGroupConfiguration``
79+
- ``ServiceGroupError``
7980

8081
### Graceful Shutdown
8182

82-
- ``withGracefulShutdownHandler(operation:onGracefulShutdown:)``
83-
- ``cancelOnGracefulShutdown(_:)``
84-
85-
### Errors
83+
- ``gracefulShutdown()``
84+
- ``cancelWhenGracefulShutdown(_:)``
85+
- ``withTaskCancellationOrGracefulShutdownHandler(isolation:operation:onCancelOrGracefulShutdown:)``
86+
- ``withGracefulShutdownHandler(isolation:operation:onGracefulShutdown:)``
87+
- ``AsyncCancelOnGracefulShutdownSequence``
8688

87-
- ``ServiceGroupError``
89+
- ``cancelOnGracefulShutdown(_:)``
90+
- ``withGracefulShutdownHandler(operation:onGracefulShutdown:)``
91+
- ``withGracefulShutdownHandler(operation:onGracefulShutdown:)-1x21p``
92+
- ``withTaskCancellationOrGracefulShutdownHandler(operation:onCancelOrGracefulShutdown:)-81m01``

Sources/ServiceLifecycle/GracefulShutdown.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public func withGracefulShutdownHandler<T>(
5858
return try await operation()
5959
}
6060

61+
/// Execute an operation with a graceful shutdown handler that’s immediately invoked if the current task is shutting down gracefully.
62+
///
63+
/// Use ``withGracefulShutdownHandler(isolation:operation:onGracefulShutdown:)`` instead.
6164
@available(*, deprecated, message: "Use the method with the isolation parameter instead.")
6265
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
6366
@_disfavoredOverload
@@ -142,6 +145,11 @@ public func withTaskCancellationOrGracefulShutdownHandler<T>(
142145
handler()
143146
}
144147
}
148+
149+
/// Execute an operation with a graceful shutdown or task cancellation handler that’s immediately invoked if the current task is
150+
/// shutting down gracefully or has been cancelled.
151+
///
152+
/// Use ``withTaskCancellationOrGracefulShutdownHandler(isolation:operation:onCancelOrGracefulShutdown:)`` instead.
145153
@available(*, deprecated, message: "Use the method with the isolation parameter instead.")
146154
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
147155
@_disfavoredOverload
@@ -156,6 +164,10 @@ public func withTaskCancellationOrGracefulShutdownHandler<T>(
156164
}
157165
}
158166
#else
167+
/// Execute an operation with a graceful shutdown or task cancellation handler that’s immediately invoked if the current task is
168+
/// shutting down gracefully or has been cancelled.
169+
///
170+
/// Use ``withTaskCancellationOrGracefulShutdownHandler(isolation:operation:onCancelOrGracefulShutdown:)`` instead.
159171
@available(*, deprecated, message: "Use the method with the isolation parameter instead.")
160172
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
161173
@_disfavoredOverload
@@ -244,6 +256,7 @@ public func cancelWhenGracefulShutdown<T: Sendable>(
244256

245257
/// Cancels the closure when a graceful shutdown was triggered.
246258
///
259+
/// Use ``cancelWhenGracefulShutdown(_:)`` instead.
247260
/// - Parameter operation: The actual operation.
248261
#if compiler(>=6.0)
249262
@available(*, deprecated, renamed: "cancelWhenGracefulShutdown")

Sources/ServiceLifecycle/ServiceGroup.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public actor ServiceGroup: Sendable, Service {
4747
/// The current state of the group.
4848
private var state: State
4949

50-
/// Initializes a new ``ServiceGroup``.
50+
/// Initializes a service group.
5151
///
5252
/// - Parameters:
5353
/// - configuration: The group's configuration
@@ -68,7 +68,7 @@ public actor ServiceGroup: Sendable, Service {
6868
self.maximumCancellationDuration = configuration._maximumCancellationDuration
6969
}
7070

71-
/// Initializes a new ``ServiceGroup``.
71+
/// Initializes a service group.
7272
///
7373
/// - Parameters:
7474
/// - services: The groups's service configurations.
@@ -91,6 +91,9 @@ public actor ServiceGroup: Sendable, Service {
9191
self.init(configuration: configuration)
9292
}
9393

94+
/// Initializes a service group.
95+
///
96+
/// Use ``init(services:gracefulShutdownSignals:cancellationSignals:logger:)`` instead.
9497
@available(*, deprecated, renamed: "init(services:gracefulShutdownSignals:cancellationSignals:logger:)")
9598
public init(
9699
services: [any Service],

0 commit comments

Comments
 (0)