Skip to content

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Apr 9, 2020

motivation: finalize naming and API towards 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

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
@tomerd tomerd added this to the 1.0.0 milestone Apr 9, 2020
@tomerd tomerd requested review from ddossot, ktoso, weissi and yim-lee April 9, 2020 23:08
@tomerd tomerd modified the milestones: 1.0.0, 1.0.0-alpha.2 Apr 10, 2020
@tomerd tomerd changed the title refactor for 1.0 refactor towards 1.0 Apr 10, 2020

let package = Package(
name: "swift-service-launcher",
name: "swift-service-bootstrap",
Copy link
Contributor

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.

Copy link
Contributor

@ktoso ktoso left a 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
Copy link
Contributor

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()) {
Copy link
Contributor

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 {
Copy link
Contributor

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?

Copy link
Contributor

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)

Copy link
Contributor Author

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

Copy link
Collaborator

@yim-lee yim-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tomerd tomerd merged commit a22bf0b into swift-server:master Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

finalize naming is ServiceLauncher a good name? docs about nesting ServiceLaunchers
4 participants