-
Notifications
You must be signed in to change notification settings - Fork 41
add support for stateful handler #84
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
3c59e86
to
f389916
Compare
one year later, but this addresses #11 if I understand the need correctly |
6baa856
to
164106e
Compare
b833f28
to
5e4546c
Compare
motivation: allow lifecycle handlers to have the library manage the state for them so they do not need to do that manually changes: * introduce LifecycleStartHandler and LifecycleShutdownHandler which can handle state on behalf of the lifecycle item * add registerStateful function to regsiter stateful handlers * add tests
5e4546c
to
397eade
Compare
@swift-server-bot test this please |
2 similar comments
@swift-server-bot test this please |
@swift-server-bot test this please |
For example, when establishing some sort of a connection that needs to be closed at shutdown. | ||
|
||
```swift | ||
struct Foo { |
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.
Or if it conforms to LifecycleStartHandler
one could just pass it as?
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.
Ah i see... you only surface the new APIs really, not forcing people to impl anything. That sounds good 👍
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.
Awesome, just what I'd need/love :-)
I think the API is expressed also very nicely, does not differ much from the existing one etc.
LGTM!
motivation: allow lifecycle handlers to have the library manage the state for them so they do not need to do that manually
changes: