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

Introducing The Big Rewrite #8

Closed
mickeyl opened this issue Sep 30, 2022 · 0 comments
Closed

Introducing The Big Rewrite #8

mickeyl opened this issue Sep 30, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@mickeyl
Copy link
Contributor

mickeyl commented Sep 30, 2022

I have decided to (pretty much) rewrite CornucopiaStreams ­– the major reason being me and Swift having changed quite a bit over the last two years.

With 2.0, I'm trying to achieve two things ­– lifecycle and async correctness:

  1. Lifecycle correctness: In 1.0, CornucopiaStreams was still active after the connection was established. It held some references and to cleanup correctly, you would have to notify CornucopiaStreams after you were done with your stream usage. In 2.0, I have shifted CornucopiaStreams to be much more of a broker, hence it pretty much moves away once the connection has been established.
  2. Async correctness: The whole framework is now based around Swift asynchronous connect call. Since many of the connectors do their work inherently asynchronously, this matches the problem domain much better. Moreover, cancelling now works correctly and there are no more memory leaks.

While 1.0 was implemented as an extension on Foundation's Stream, it felt more natural to move it into its own namespace. Therefore, an API change was inevitable. The last version of 1.0 is still available on the legacy branch.

@mickeyl mickeyl added the enhancement New feature or request label Sep 30, 2022
@mickeyl mickeyl added this to the 2.0 (Big Rewrite) milestone Sep 30, 2022
mickeyl added a commit that referenced this issue Sep 30, 2022
@mickeyl mickeyl pinned this issue Sep 30, 2022
mickeyl added a commit that referenced this issue Sep 30, 2022
With this patch we have achieved feature parity w/ the legacy branch.
The only thing missing is the synchronous connect() which will not
be implemented. If you really need that, you can perhaps wrap it with a device
like https://github.com/Cornucopia-Swift/CornucopiaCore/blob/master/Sources/CornucopiaCore/Features/Concurrency/WithBlockingWait.swift
@mickeyl mickeyl closed this as completed Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant