1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00
Commit Graph

247 Commits

Author SHA1 Message Date
Daniel Lowrey
30245d6817 Add optional callback data param in Deferred::__construct() 2015-05-19 11:16:04 -04:00
Daniel Lowrey
953c4612e6 Future -> Deferred 2015-05-19 00:21:33 -04:00
Daniel Lowrey
3af013d418 Expose boolean AMP_DEBUG for performance tuning
Amp Future instances double both as Promisor and Promise
implementations when AMP_DEBUG is defined and set to false.
This switch allows private Promise resolution safety by
default at the expense of performance.

Amp applications should set AMP_DEBUG to false in production
environments to maximize performance.
2015-05-18 23:57:34 -04:00
Daniel Lowrey
0973bba5ef Add PromiseStream to stream Promise updates without callback hell 2015-05-18 17:39:09 -04:00
Daniel Lowrey
93eb8ad8de Suggest nearby property name in Struct error messages 2015-05-13 10:05:56 -04:00
Daniel Lowrey
2eb944d6ec skip libevent tests if extension not loaded 2015-05-04 12:58:11 -04:00
Daniel Lowrey
cddb8e9f08 Backport API changes to 5.5+ compat 2015-05-04 12:48:29 -04:00
Daniel Lowrey
812e1fb6b4 Reactor API updates, NativeReactor refactor 2015-04-03 11:56:16 -04:00
Daniel Lowrey
2aa4c0c357 Remove libevent reactor until pecl/libevent supports php7 2015-04-03 11:55:23 -04:00
Daniel Lowrey
654e82f277 minor cleanup 2015-03-23 11:07:40 -04:00
Daniel Lowrey
018564e47b Update tests 2015-03-18 12:13:17 -04:00
Daniel Lowrey
834255163c Refactor coroutine functionality 2015-03-16 15:00:17 -04:00
Daniel Lowrey
a573e195a6 Allow null implicit yields 2015-02-18 09:53:55 -05:00
Daniel Lowrey
b1a5d113a8 Add tests for Promisor::update() 2015-02-05 23:44:11 -05:00
Daniel Lowrey
99e38762a7 - Added Reactor::coroutine() method
- Added `Amp\coroutine()` function
- `YieldCommands` "enum" constant class removed -- yield keys now live in
  the reactor class
- New optional `"coroutine"` yield key for self-documenting generator
  yields.
- New optional `"async"` yield key for self-documenting promise yields.
- New `"return"` yield key for specifying the return value of a resolved
  Generator coroutine. If not specified a resolved coroutine result is
  equal to null.
- The final value yielded by a resolved `Generator` is *no longer* used
  as its "return" value. Instead, generators must manually use the new
  `"return"` yield key specifically to designate the value that should
  be used to resolve the promise associated with generator resolution.
- `GeneratorResolver` trait renamed to `CoroutineResolver` and is now an
  abstract class extended by the various `Reactor` implementations.
- Implicit "all" array combinator resolution is now removed. Use the
  explicit form instead:

```php
function() {
    list($a, $b, $c) = (yield 'all' => [$promise1, $promise2, $promise3]);
};
```
2015-02-03 19:41:15 -05:00
Daniel Lowrey
49b7a73a8d Minor libevent reactor bugfixes 2014-12-04 19:30:23 -05:00
Daniel Lowrey
a8fe6e2e39 Fix combinator function derps 2014-12-04 13:34:42 -05:00
Daniel Lowrey
934d1aeffb Return promise/result from bound functions 2014-12-02 12:43:00 -05:00
Daniel Lowrey
62de0cbc18 Implement 'bind' yield command 2014-12-02 11:52:41 -05:00
Daniel Lowrey
090bdf55ed Rename "wait" yield command -> "pause" to avoid confusion with "nowait" and Amp\wait() 2014-12-02 11:29:19 -05:00
Daniel Lowrey
ba55ae360f Fix minor inconsistency Reactor::stop() called from immediately watcher 2014-12-02 01:09:51 -05:00
Daniel Lowrey
f32d088c23 Lots of changes ... see CHANGELOG for details 2014-12-01 19:45:57 -05:00
Daniel Lowrey
c75a8514a1 Reactor is now optional for combinator functions 2014-11-25 12:46:29 -05:00
Daniel Lowrey
1cb293b776 Remove Combinator/Resolver in favor of functions
This commit removes the Combinator and Resolver classes altogether.
The relevant functionality is now concentrated entirely in the
analogous functions:

- all()
- some()
- any()
- first()
- map()
- filter()
- resolve()

Additionally, all Promisor implementations now *require* a Reactor
upon instantiation. Previously this parameter could be null and the
static singleton reactor instance would be used automatically.
2014-11-24 23:14:07 -05:00
Daniel Lowrey
2d5a1eb643 Allow multiple IO watchers on a stream without borking libuv 2014-11-18 10:08:34 -05:00
Daniel Lowrey
874e7dab90 Formalize resolver yield commands 2014-11-05 11:56:35 -05:00
Daniel Lowrey
3e585120c2 Update Resolver tests 2014-10-22 18:14:56 -04:00
Daniel Lowrey
969d15ebe8 Add Combinator class 2014-09-23 23:47:20 -04:00
Daniel Lowrey
7064ec5dc8 Migrate repo to amphp/amp 2014-09-23 00:06:03 -04:00
Daniel Lowrey
56e720cd50 Merge concurrency primitives 2014-09-22 22:21:22 -04:00
Daniel Lowrey
df47c6f09b Use string watcher IDs 2014-08-22 14:08:31 -04:00
Daniel Lowrey
c7c5b0ba8f Standardize all watcher invocation params to: func($reactor, $watcherId, $data) 2014-08-09 10:30:32 -04:00
Daniel Lowrey
c1521d6d7c Always execute immediately watchers in fresh call stack 2014-08-08 14:23:00 -04:00
Daniel Lowrey
db565c95b1 unit test cleanup + composer adjustment 2014-08-02 02:17:50 -04:00
Daniel Lowrey
c3650dce88 Fixed really epic syntax fail 2014-08-02 01:09:07 -04:00
Daniel Lowrey
bbd2ca2075 Add libuv php-uv event reactor 2014-06-11 12:33:15 -04:00
Daniel Lowrey
c2b311eebb Miscellaneous changes 2014-06-11 12:24:46 -04:00
Daniel Lowrey
112eee97bf Remove orphaned test 2014-05-06 18:25:35 -04:00
Daniel Lowrey
885969ff84 Time intervals now expressed in milliseconds (was seconds) 2014-03-07 12:02:03 -05:00
Daniel Lowrey
4e3a7598ef Test CHANGELOG and composer.json updates 2014-03-06 21:46:57 -05:00
Daniel Lowrey
aed5c84c03 Add Future/Promise implementation 2014-03-06 11:47:50 -05:00
Daniel Lowrey
861cb58023 File structure reorganization 2014-03-06 09:53:16 -05:00
Daniel Lowrey
6da223b0f9 Fixed potential PHP_INT_MAX watcher ID overwrite 2013-11-29 13:40:34 -05:00
Daniel Lowrey
110e8f2fef Removed unnecessary intermediary garbage storage 2013-11-17 17:58:41 -05:00
Daniel Lowrey
73fc260f15 libevent reactor forking cleanup/fixes/refactoring 2013-09-12 19:59:05 -04:00
Daniel Lowrey
f2b837ba19 Added Forkable interface for managing libevent resource forking 2013-08-29 02:42:10 -04:00
Daniel Lowrey
d65224aeb3 Initial release commit 2013-08-07 00:17:57 -04:00