1
0
mirror of https://github.com/danog/amp.git synced 2024-12-11 17:09:40 +01:00
Commit Graph

707 Commits

Author SHA1 Message Date
Aaron Piotrowski
7a6fa6fd34
Simplify AsyncGenerator too 2020-10-02 14:14:30 -05:00
Aaron Piotrowski
4af828f30d
Merge branch update-tests into v3 2020-10-02 13:59:54 -05:00
Aaron Piotrowski
8bd6cff602
Update Struct to use reflection
Typed properties requires reflection.
2020-10-02 13:56:40 -05:00
Aaron Piotrowski
0933a501fd
Remove unnecessary version checks 2020-10-02 13:56:17 -05:00
Aaron Piotrowski
d62ba46fb4
Fix pipeline functions 2020-10-02 13:55:58 -05:00
Aaron Piotrowski
bf58e595be
Defer cancellation callback 2020-10-02 13:55:46 -05:00
Aaron Piotrowski
492442db2d
Check run count on dispatch 2020-10-02 13:55:00 -05:00
Niklas Keller
3219618fd8 Add deprecations 2020-09-29 21:25:42 +02:00
Niklas Keller
55af98a8ba Simplify Coroutine 2020-09-29 21:13:30 +02:00
Aaron Piotrowski
32c2cd6d64
Drop Loop::run() and Loop::stop()
This is a *huge* shift, but there’s no reason for these to exist in a world with top-level await.
2020-09-27 09:38:52 -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
7e03928faf
Drop CallableMaker 2020-09-26 22:31:08 -05:00
Aaron Piotrowski
07a9965ba6
Run promisor in LazyPromise in new fiber 2020-09-26 22:26:57 -05:00
Aaron Piotrowski
b65823e0bb
Refactor Coroutine to use await()
Dropped polyfill, ext-fiber will be required to run any v3 code.
2020-09-26 22:22:07 -05:00
Aaron Piotrowski
9f68bd4046
Remove Driver::run() and stop()
Added Driver::isRunning().

Driver now must be started and stopped through an instance of DriverControl.
2020-09-26 12:50:30 -05:00
Aaron Piotrowski
9a2ebe777a
Merge branch 'kelunik-nested-wait' into v3 2020-09-26 11:40:38 -05:00
Aaron Piotrowski
b35c9f1956
Fix throw from send 2020-09-25 12:57:56 -05:00
Aaron Piotrowski
72b50523a3
Add separate method to await back pressure 2020-09-25 12:32:37 -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
6dd2b990f8
Revert AsyncGenerator being lazy 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
3fb87e2c18
Fix Psalm errors 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
1577906fc1
Make AsyncGenerator execution lazy
Matches behavior of Generator which does not start execution until an iteration method is invoked.
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
e1402f8484
Remove StreamModifier
I'd rather put this in another repo.

For discoverability, we can add links to the repo in the docblocks here and on amphp.org.
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
94e01e7e49
Fix apply() 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
Aaron Piotrowski
12c97b2561
Add explicit dispose() method to Stream 2020-09-24 12:53:28 -05:00
Aaron Piotrowski
96007f11aa
Add Streams 2020-09-24 12:53:27 -05:00
Niklas Keller
05483cdbef
Enforce timer interval as minimum time to execution (#319)
Co-authored-by: Aaron Piotrowski <aaron@trowski.com>
2020-07-14 21:45:35 +02:00