Skip to content
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

Resource management in streams #27

Open
Primetalk opened this issue Jun 17, 2022 · 3 comments
Open

Resource management in streams #27

Primetalk opened this issue Jun 17, 2022 · 3 comments
Assignees

Comments

@Primetalk
Copy link
Owner

Currently streams can only use resources provided at the top level via ordinary resource.Use.
Sometimes we need to pass streams around and we wish that resources are correctly released when stream is either finished or thrown away.

@Primetalk Primetalk self-assigned this Jun 17, 2022
@Primetalk
Copy link
Owner Author

This requires adding a finalizer to all stream steps. Then in every stream executor, these finalizers should be respected and appended to io.

@Primetalk
Copy link
Owner Author

Signature might look like

stream.Finally[A any](stm stream.Stream[A], func () io.IOUnit) stream.Stream[A]

@Primetalk
Copy link
Owner Author

There are two FStreams - one that is just a pair of stream and IO to finalize, and another one - IO of such pair. The difference is that IO represents a stream that has not yet been started.

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

No branches or pull requests

1 participant