-
Notifications
You must be signed in to change notification settings - Fork 45
refactor towards 1.0 #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
motivation: finalize naming and API for 1.0 changes: * rename package to swift-service-boostrap * rename modules to Lifecycle and LifecycleNIOCompat * create top level namespace named Lifecycle * rename LifecycleItem to LifecycleTask, with Lifecycle.Task typealias * define top-level type called ServiceLifecycle where signal handling and backtraces are handled * rename Lifecycle to ComponentLifecycle and conform it to Lifecycle.Task so that lifecycles can be nested * change shutdown to return an error to better conform with Lifecycle.Task api * improve logging * improve API docs * adjust tests
Co-Authored-By: Yim Lee <[email protected]>
|
||
let package = Package( | ||
name: "swift-service-launcher", | ||
name: "swift-service-bootstrap", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a bit weird that the word Bootstrap does not appear in code...
I'm hopeful perhaps we could rename some day to lifecycle here OR perhaps
🟢 not blocker tho, let's discuss on forums as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's get it out there and keep on some of the other discussions in the open :-)
// MARK: - Lifecycle (namespace) | ||
|
||
public enum Lifecycle { | ||
public typealias Task = LifecycleTask |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
/// | ||
/// - parameters: | ||
/// - configuration: Defines lifecycle `Configuration` | ||
public init(configuration: Configuration = .init()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 that config is in init and not start() (i think it used to be there)
self.configuration = configuration | ||
self.lifecycle = ComponentLifecycle(label: "Lifecycle", logger: self.configuration.logger) | ||
// setup backtrace trap as soon as possible | ||
if configuration.installBacktrace { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick :-)
Should installing backtrace be expressed as a LifecycleTask
which we automatically add when it's enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(can be fixed in follow up / separate ticket)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a cool idea! #35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
motivation: finalize naming and API towards 1.0
changes: