1
0
mirror of https://github.com/danog/amp.git synced 2024-12-04 02:17:54 +01:00
Commit Graph

165 Commits

Author SHA1 Message Date
Aaron Piotrowski
2f658986f9
Async resume done by Suspension now 2021-03-28 22:23:53 -05:00
Aaron Piotrowski
d2a5f7e9df
Use Suspension instead of promises in EmitSource 2021-03-28 12:39:11 -05:00
Niklas Keller
9a568b133f Use microtasks for promise callbacks 2021-03-27 16:23:32 +01:00
Niklas Keller
2f778fe069 Use revolt
Removes deprecated APIs.
2021-03-26 22:34:32 +01:00
Aaron Piotrowski
4290bd7e28
Update to simpler ext-fiber API 2021-02-11 23:02:31 -06:00
Aaron Piotrowski
f02dbc8585
Update for FiberScheduler changes 2021-01-04 13:57:33 -06:00
Aaron Piotrowski
7c7e0ea554
Rename Loop::get() to Loop::getDriver()
Also Loop::set() to Loop::setDriver().
2020-12-12 12:15:18 -06:00
Aaron Piotrowski
ee8343e566
Update for ext-fiber suspend API change 2020-12-09 11:22:47 -06:00
Aaron Piotrowski
8865458454
throw is now an expression! 2020-11-29 22:36:55 -06:00
Aaron Piotrowski
74a24b36df
Rearrange EmitSouce::push() 2020-11-29 00:04:42 -06:00
Aaron Piotrowski
051320a30f
Update for ext-fiber changes 2020-11-21 00:18:14 -06:00
Aaron Piotrowski
73bf4c35b9
Minor optimization to consuming values 2020-11-18 12:35:52 -06:00
Aaron Piotrowski
f7f37aa86e
Avoid creating unnecessary promise objects
If backpressure is always awaited, this avoids creating promises.
2020-11-17 17:28:28 -06:00
Aaron Piotrowski
014adbd89e
Fix emit after disposal 2020-11-16 17:20:13 -06:00
Aaron Piotrowski
a2a78939b9
Use Traversable as return type
Reduces the likelihood of using next()/current() concurrently.
2020-11-10 21:56:00 -06:00
Aaron Piotrowski
791885592e
Remove unnecessary indirection
Also updated some psalm params and returns.
2020-11-10 13:28:43 -06:00
Aaron Piotrowski
fa31b4b3d5
Pipeline extends Traversable
Allows pipelines to be used directly with foreach.
2020-11-10 12:05:47 -06:00
Aaron Piotrowski
f3b189f33f
Update for Continuation 2020-11-05 11:29:31 -06:00
Aaron Piotrowski
cff6bba499
Missed an Awaitable usage 2020-11-05 10:16:42 -06:00
Aaron Piotrowski
ae42c11053
Allow failing pipeline with DisposedException 2020-11-03 17:02:56 -06:00
Aaron Piotrowski
865238bc16
Use fiber directly when emitting values 2020-11-03 16:55:29 -06:00
Aaron Piotrowski
0838d483fe
Rethrow in loop from any Awaitable failure 2020-11-01 11:19:17 -06:00
Aaron Piotrowski
6cf7ae13bb
Remove automatic Generator to Coroutine conversion 2020-10-30 10:36:19 -05:00
Aaron Piotrowski
7612ef3f1e
Drop direct conversion of React promises
React promises are still supported using Amp\Promise\adapt().
2020-10-30 10:19:12 -05:00
Aaron Piotrowski
1b30909215
Remove succeed() and fail() 2020-10-04 10:22:51 -05:00
Aaron Piotrowski
0eceb48fad
Refactor internal traits as classes
Trait tests should test Deferred and Emitter instead, will update with other tests.
2020-09-26 23:14:17 -05:00
Aaron Piotrowski
d48e6bd5d2
Add more class and return types
More PHP 7.1 to 8 types added.
2020-09-24 22:17:13 -05:00
Aaron Piotrowski
8e4cc1bbd1
Refactor Pipeline for async/await 2020-09-24 22:14:58 -05:00
Aaron Piotrowski
5f6db028ab
Initial fiber support 2020-09-24 12:53:32 -05:00
Aaron Piotrowski
9a13937fef
Make explicit disposal fail pending promises
Destruction of the pipeline does not fail pending promises, but calling dispose() now will.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
657614c036
Dispose after all pending promises are fulfilled
Allows continue() to be called, then dispose(), but the pipeline is not actually disposed until those pending promises are fulfilled.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
5e521daa16
Rename to Pipeline 2020-09-24 12:53:31 -05:00
Aaron Piotrowski
52d50a5b6d
Revert adding onDisposal() and onCompletion()
This largely reverts 6ab9048e717bb1f69f418d82e697a968721115c0.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
dd0f01f4db
Add onDisposal() and onCompletion() to Stream
onCompletion callbacks are invoked if complete() or fail() is called before the stream is disposed.

onDisposal callbacks are invoked if the stream is disposed before being completed or failed.

Forbid failing a stream with DisposedException.
2020-09-24 12:53:31 -05:00
Aaron Piotrowski
42d8ce764b
Add StreamSource::onDisposal() 2020-09-24 12:53:31 -05:00
Aaron Piotrowski
217c31c5ce
Add Promise\succeed() and Promise\fail() 2020-09-24 12:53:31 -05:00
Aaron Piotrowski
ee76c97c51
Add StreamSource::isDisposed() 2020-09-24 12:53:30 -05:00
Aaron Piotrowski
0ddf9a656e
Add Deferred::isResolved() and StreamSource::isComplete() 2020-09-24 12:53:30 -05:00
Aaron Piotrowski
5d0adebaa2
Add isDebugEnabled function 2020-09-24 12:53:30 -05:00
Aaron Piotrowski
f4cc591988
Feedback update 2020-09-24 12:53:30 -05:00
Aaron Piotrowski
b64b3affc9
Rename yield() to emit() 2020-09-24 12:53:30 -05:00
Aaron Piotrowski
66f0deb563
Drop YieldedValue 2020-09-24 12:53:29 -05:00
Aaron Piotrowski
dae252aea0
Rethrow exceptions from destructors 2020-09-24 12:53:29 -05:00
Aaron Piotrowski
8df006b011
Remove unnecessary internal interface
Switched Yielder trait to a concrete class YieldSource.
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
d496c9db24
Resolve promise with YieldedValue
A suggested alternative to resolving with [$yieldedValue] since static analysis (specifically Psalm) doesn't play well with that API.

Will revert if Psalm changes or we decide to resolve with [$yieldedValue] anyway.
2020-09-24 12:53:29 -05:00
Aaron Piotrowski
57924690fe
Remove key 2020-09-24 12:53:29 -05:00
Aaron Piotrowski
704f87ccc8
Use separate objects for stream ops 2020-09-24 12:53:28 -05:00
Aaron Piotrowski
3755155e51
Add callback to transform()
Suggestion for an apply()-like method.
2020-09-24 12:53:28 -05:00
Aaron Piotrowski
1b4863b7b3
Don't re-wrap stream 2020-09-24 12:53:28 -05:00
Aaron Piotrowski
6283d9bbb7
Intial stream transformations 2020-09-24 12:53:28 -05:00