10 Commits
Author SHA1 Message Date
Vladimir Kukushkin db7637f5cd Support custom service names (#233)
Add an extra `serviceName` field to the `ServiceConfiguration` to
customize SSL logs metadata.

Motivation:

This would allow giving meaningful name to services and service groups.
Closes #220.

Modifications:

- Added `.serviceName` to the `ServiceConfiguration`.
- Added a new initializer for `ServiceConfiguration` with `serviceName`
param.
- Logs now use `.serviceName` instead of `.service` for `sl-service`
metadata value.

Result:

Different `ServiceGroup`s can be distinguished in the logs.
2026-03-30 21:37:52 +01:00
Joseph Heck 83cecce066 extending the documentation content (#212)
- cleaning up grammar to use present tense and more direct phrasing
- extending documentation coverage

Current state:
```
                | Abstract        | Curated         | Code Listing
Types           | 71% (10/14)     | 64% (9/14)      | 0.0% (0/14)
Members         | 44% (49/111)    | 77% (85/111)    | 0.0% (0/111)
Globals         | 73% (8/11)      | 91% (10/11)     | 9.1% (1/11)
```
2025-09-19 08:31:20 +00:00
Joseph Heck 4c5efa9806 adding abstracts and organization to methods (#205)
A little bit of docs cleanup - adding abstracts for deprecated methods
and curating them (organizing them) to the bottom of the relevant lists.
2025-05-06 19:19:53 +00:00
George Barnett e718730918 Remove platforms from manifest (#203)
Motivation:

Adding or raising the deployment platforms in the package manifest is a
SemVer major breaking change as consumers must also add or raise their
deployment platforms. This is a known limitation of SwiftPM.

Unforunately this means that it's very difficult for non-leaf packages
to adopt packages which declare their platforms in the manifest. Doing
so puts the brakes on adoption and ecosystem growth. For 'core' packages
like this one availability constraints should be expressed on
declarations rather than in the manifest.

Modifications:

- Remove platforms from the package manifest
- Add availability annotations to types which require it

Result:

This package can be more widely adopted
2025-04-23 08:59:36 +00:00
Franz Busch f70b838872 [CI] Adopt GitHub actions (#187)
# Motivation

We want to switch our CI to GitHub actions.

# Modification

This PR sets up the reusable workflows from NIO.

# Result

More modern CI.
2024-10-31 12:17:45 +01:00
Max Desiatov 05031271bf Update TerminationBehavior doc comments and notes (#165)
* Mention `TerminationBehavior` in library adoption docs

`ServiceGroupConfiguration.ServiceConfiguration.TerminationBehavior` did not seem to be mentioned in the docs and specifically library adoption docs gave the impression that cancellation on returning from `run` is the only option.

* Update relevant documentation
2024-01-25 14:24:30 +00:00
Franz Busch d673fdc912 Add a configurable escalation behaviour (#162)
* Add a configurable escalation behaviour

# Motivation
The service group is often running multiple services and orchestrates shutdown for them. We have seen that sometimes some services never shutdown nor do they respond to task cancellation properly. This can become quite problematic when the whole application is waiting for a service to cancel and otherwise appears to be healthy but in reality can't serve any traffic.

# Modification
This PR adds a new configuration to escalate both graceful shutdown and cancellation. The escalation order is graceful shutdown -> task cancellation -> `fatalError`. The `fatalError` acts a last resort to make sure applications are never stuck.

* George review

* Fix some smaller issues
2023-10-13 06:02:25 -07:00
Franz Busch 748fcf39d0 Prefix default logging keys (#149)
# Motivation
To avoid colliding with logging keys of adopters we should prefix our default metadata logging keys.

# Modification
This PR prefixes our default logging keys with `sl-`.
2023-08-16 13:29:57 +01:00
Franz Busch f58dbbfaa9 Add support for return/ThrowBehavior of services (#148)
* Add support for `return/ThrowBehavior` of services

# Motivation

Currently the `ServiceGroup` cancels the whole group when a service returns or throws. This is fine for most server applications but it doesn't work for CLI tools since they mostly want to use the group to orchestrate the services as long as the user command is handled and then return cleanly from the group. Furthermore, even on server setups one might want to customize the behavior of what happens when a service returns/throws e.g. one might want to shutdown the group after their HTTP server throws so that a telemetry service flushes out all the remaining data.

# Modification

This PR does a few things:
1. It creates a new `ServiceConfiguration` and `TerminationBehavior` in the `ServiceGroupConfiguration`. Those can be used to declare the services that are run and what happens when the service returns or throws
2. Adds a new `cancellationSignals` to to the `ServiceGroupConfiguration` which allows cancellation to trigger based on a signal
3. Makes sure that any given service is only retained as long as necessary i.e. when a service returns the group is not retaining it anymore. This allows freeing of resources as early as possible
4. Breaking: Removes the `Hashable` conformance on the configuration structs. This was wrong in the first place and something we should just avoid doing in general.

# Result
We now give the user even more control about the group's behaviors.

* Review

* Review

* Fix CI
2023-08-16 13:22:22 +01:00
Franz Busch 7a8226c92d Add logger argument in the README (#141)
# Motivation
We were missing a `logger` argument for the `ServiceGroup` in the README.

# Modification
Adds the missing `logger` argument and renames a file

# Result
Fixes https://github.com/swift-server/swift-service-lifecycle/issues/139
2023-05-30 11:22:58 +01:00