Niklas Keller
568183b261
Update to event-loop 0.5.0
2017-01-07 13:45:03 +01:00
Niklas Keller
559c64fdb8
Add test for invalid stream arguments
2017-01-06 23:16:06 +01:00
Aaron Piotrowski
c80f264e7e
Remove unneeded support check
2017-01-05 17:21:30 -06:00
Aaron Piotrowski
02c2fcf0fa
Add implementation using event extension
2017-01-05 14:08:33 -06:00
Aaron Piotrowski
210b6ff258
Observable → Stream
2017-01-03 19:10:27 -06:00
Josh Di Fabio
b9b49b3eaf
Change namespace to AsyncInterop\Loop
2017-01-02 20:48:48 +00:00
Aaron Piotrowski
7cd505342a
Update PromiseTest
...
setUp() and tearDown() code moved to async-interop/promise-test
2016-12-30 13:01:09 -06:00
Aaron Piotrowski
a872f14fd4
Drop Amp\range(), add Amp\observableFromIterable()
2016-12-30 12:50:09 -06:00
Aaron Piotrowski
b5d5b8dff1
Drop loop wrapper functions
2016-12-29 16:57:08 -06:00
Aaron Piotrowski
5651240615
Update to promise spec v0.3
...
Dropped strict-types due to spec requiring weak types in callbacks.
2016-12-29 16:29:27 -06:00
Aaron Piotrowski
b1e58862b2
Add extension required annotations on Ev and Uv loop tests
2016-12-29 14:47:06 -06:00
Aaron Piotrowski
225c0703ee
Merge branch 'event-loop-v0.4' into uv
2016-12-28 13:02:20 -06:00
Niklas Keller
53bd12bbbd
Rename Loop::info to Loop::getInfo
...
We use `get` for all other similar methods, too. Closes #102 .
2016-12-23 10:58:26 +01:00
Aaron Piotrowski
8ef760f53c
More tests
2016-12-17 08:16:17 -06:00
Aaron Piotrowski
11f1c7e7c4
Amp\lazy() → Amp\Lazy
...
Plus some tests!
2016-12-15 18:50:33 -06:00
Aaron Piotrowski
6e97e6630d
Fix some function bugs and add more tests
2016-12-15 17:31:57 -06:00
Aaron Piotrowski
c73ca4e427
Add Emitter and Observer tests
2016-12-13 15:29:54 -06:00
Niklas Keller
1299e51ca6
Add tests for InvalidYieldError, improve key display
...
Without something like var_export, null and false are casted to an empty string.
2016-12-11 17:08:17 +01:00
Niklas Keller
a66f25e4f6
Fix tests
2016-12-11 16:39:58 +01:00
Aaron Piotrowski
3f2e0e1b72
Fix method name in wait() test
2016-11-14 16:29:49 -06:00
Aaron Piotrowski
9927ad5b4f
Awaitable → Promise
2016-11-14 13:59:21 -06:00
Aaron Piotrowski
96e1178b89
Code, docblock, and comment cleanup
2016-08-17 22:25:54 -05:00
Aaron Piotrowski
a8d7d71a1a
Drop Future and Producer
2016-08-17 21:17:31 -05:00
Aaron Piotrowski
36bfc3e20a
Fix namespace
2016-08-16 23:27:10 -05:00
Aaron Piotrowski
8eda038155
Use strict types in tests; update some tests
2016-08-16 16:39:25 -05:00
Aaron Piotrowski
7bc08b9a6a
Replace leftover LogicExceptions exceptions with Error
2016-08-12 16:58:53 -05:00
Aaron Piotrowski
496152282e
Update Amp\coroutine() tests
2016-08-12 16:56:13 -05:00
Aaron Piotrowski
69ec812bc0
Require PHP 7
2016-08-11 14:52:40 -05:00
Niklas Keller
74e2577b25
Rename fetch/storeState to get/setState
2016-08-06 14:49:08 +02:00
Niklas Keller
6cde9f5495
Merge Registry into Driver
2016-08-04 21:08:52 +02:00
Aaron Piotrowski
9055f159e7
Revert some() to v1 behavior
2016-07-31 00:31:04 -05:00
Aaron Piotrowski
5a06b1cdc1
Update tests and remove unused tests
2016-07-19 00:05:40 -05:00
Aaron Piotrowski
ade997688a
Merge branch 'awaitable' into v2
2016-07-18 23:20:05 -05:00
Aaron Piotrowski
3f654cbd5b
Initial tests plus some fixes
2016-07-12 11:20:06 -05:00
Bob Weinand
3603d5b1ec
EvLoop::enabled() -> supported()
2016-06-26 17:35:25 +02:00
Aaron Piotrowski
33338324d4
Add UvLoop
2016-06-09 12:57:46 -05:00
Aaron Piotrowski
666cc42a5f
Better ref/unref in EvLoop; fix EvLoopTest
2016-06-08 16:03:37 -05:00
Aaron Piotrowski
a49d333f1b
Add EvLoop; Split shared components into Loop
2016-06-08 09:22:14 -05:00
Aaron Piotrowski
ae441eb179
Fix DummyDriver
...
Conflict due to merge of #68
2016-05-31 10:08:10 -05:00
Aaron Piotrowski
5a82cd9b6b
Merge pull request #67 from async-interop/defer-callback
...
Put Loop::execute() $callback into Driver::defer()
2016-05-31 10:00:11 -05:00
Aaron Piotrowski
4aa8c5d550
Add loop tests
2016-05-27 15:07:05 -05:00
Aaron Piotrowski
237a9c45ad
Update registry test
2016-05-27 11:38:19 -05:00
Bob Weinand
b197b2c07d
Put Loop::execute() $callback into Driver::defer()
...
This also ensures that potential throwing in the callback will be handled inside a potential error handler instead of immediately falling through.
2016-05-26 23:45:27 +02:00
Aaron Piotrowski
7a2c5cdc88
Cleanup namespace
2016-05-26 10:05:17 -05:00
Niklas Keller
47edee535d
Forbid new factories while running, add scope test
2016-05-25 13:55:36 +02:00
Niklas Keller
3992374209
Apply ugly FIG braces style
2016-05-16 11:33:58 +02:00
Niklas Keller
8b3555c552
Change namespace of Registry
2016-05-16 11:02:14 +02:00
Niklas Keller
679651b242
Refactor Registry into a trait, so it can be tested separately
2016-05-16 11:02:13 +02:00
Chris Wright
6f4433dd1c
Add tests for resolve callables
2016-05-11 18:07:58 +01:00
Niklas Keller
7046ca47e1
Expose combined exceptions in combinator exception
...
Also fix indent, escape sequences and docs
2016-03-09 14:09:15 +01:00
Bob Weinand
4b667478f4
Fixed bug causing NativeReactor to run at 100% CPU
...
See also https://github.com/amphp/aerys/issues/68
2016-02-22 23:17:50 +01:00
Bob Weinand
72683085c5
Fix signal tests for when pcntl isn't loaded, but UvReactor is
2015-11-16 14:53:19 +01:00
Bob Weinand
3057329a5c
Update tests for CombinatorException, prepare tag 1.0.5
2015-09-30 14:31:53 +02:00
Daniel Lowrey
5cad406795
Normalize coroutine() return to Promise type
2015-08-07 11:01:36 -04:00
Daniel Lowrey
e209ee189d
Don't unload watchers when the run loop finishes
2015-08-05 13:13:16 -04:00
Daniel Lowrey
70f4971ae1
Remove stream() in favor of PromiseStream
2015-08-04 23:46:49 -04:00
Daniel Lowrey
98f609a99a
Clear watchers on run() loop exit, throw on invalid run/tick/stop calls
2015-08-04 11:07:13 -04:00
Daniel Lowrey
2c8727133e
functor argument is now optional in Amp\filter()
...
If no functor parameter is supplied, all results equal to FALSE
using a (bool) cast will be removed.
2015-08-01 13:28:41 -04:00
Daniel Lowrey
094899a74b
Add boolean "keep_alive" option for all watcher types
...
This option determines if the watcher will keep the run() loop
from returning. By default all watchers set "keep_alive" => true.
Setting this value to false is ideal for registering non-crucial
watchers (e.g. cache invalidation timers) that should run for the
life of the program but shouldn't prevent the event loop from
returning if all essential tasks have completed.
<?php
echo "before run\n";
run(function () {
immediately(function () {
echo "immediately\n";
});
once(function () {
echo "once\n";
}, 100, ["keep_alive" => false]);
repeat(function () {
echo "repeat\n";
}, 500, ["keep_alive" => false]);
echo "onStart end\n";
});
echo "after run\n";
The above snippet will have the following output:
before run
immediately
after run
The Amp\info() function now also reports the number of
keep_alive watchers currently registered via the "keep_alive" key.
2015-07-31 09:32:22 -04:00
Daniel Lowrey
b1f400cad5
misc v1 cleanup
2015-07-29 23:23:53 -04:00
Daniel Lowrey
56b6330114
Use object hashes as watcher IDs
2015-07-29 22:12:53 -04:00
Daniel Lowrey
8bcbba41a0
Move to procedural API
2015-07-29 16:59:53 -04:00
Daniel Lowrey
1d9d572ee5
promise updates are no longer variadic + misc formatting
2015-07-27 10:08:02 -04:00
Daniel Lowrey
38b3fbbbbb
move PromiseStream functionality into Amp\stream()
2015-07-23 15:23:45 -04:00
Daniel Lowrey
55e379e332
Rollback static coroutine methods to namespaced functions
2015-07-23 01:30:53 -04:00
Daniel Lowrey
f6be176a07
cleanup + tests
2015-07-22 11:38:17 -04:00
Daniel Lowrey
79a33c09fe
misc + testing
2015-07-21 23:59:20 -04:00
Daniel Lowrey
2cea028b1c
filter() updates and tests
2015-07-21 20:09:27 -04:00
Daniel Lowrey
932542f292
add map() combinator tests
2015-07-21 19:41:39 -04:00
Daniel Lowrey
33fd20acb3
add tests
2015-07-21 17:25:18 -04:00
Daniel Lowrey
d6b674b93b
Move coroutine functions into new Coroutine class
2015-07-21 16:14:50 -04:00
Daniel Lowrey
564a81c519
misc updates + tests
2015-07-21 12:25:34 -04:00
Daniel Lowrey
0d14e906f8
Add Pause test coverage
2015-07-20 22:29:17 -04:00
Daniel Lowrey
0e6560070b
misc updates and tests
2015-07-20 22:27:11 -04:00
Daniel Lowrey
10037fe859
Miscellaneous reactor cleanup
2015-07-20 15:42:56 -04:00
Daniel Lowrey
288530d296
Add EvReactor
2015-07-20 15:42:42 -04:00
Daniel Lowrey
1a891f54ac
Remove streamable support in coroutine resolution
2015-06-15 13:17:27 -04:00
Daniel Lowrey
f2a0488d87
Add Amp\promises() to coalesce values/promises/promisors to promises
2015-06-09 11:49:22 -04:00
Daniel Lowrey
e923ea3fde
minor timeout function/test cleanup
2015-05-31 20:18:42 -04:00
Daniel Lowrey
34088cbf52
Add timeout() function
2015-05-31 20:13:39 -04:00
Daniel Lowrey
954eaabcf5
Make promise updates variadic (ugly)
2015-05-31 19:33:55 -04:00
Daniel Lowrey
80548311af
Use the same tests as master
2015-05-25 13:33:06 -04:00
Daniel Lowrey
0c0395f7a0
Fix UvReactor bugs
2015-05-25 12:47:04 -04:00
Daniel Lowrey
f024061d22
Fix buggy PromiseStream behavior
2015-05-23 16:46:55 -04:00
Daniel Lowrey
71f9687cff
Reactor watcher option "callback_data" renamed "cb_data"
2015-05-20 15:21:59 -04:00
Daniel Lowrey
c7e4e8d0c3
Miscellaneous function changes (more after jump)
...
- Combinator functions optimized for performance
- Amp\reactor() now accepts an optional assignment parameter for
modifying the global default event reactor instance to allow for
third-party Reactor implementations.
- Renamed functions:
. Amp\getReactor() -> Amp\reactor()
- Removed functions:
. Amp\chooseReactor()
. Amp\tick()
. Amp\immediately()
. Amp\once()
. Amp\repeat()
. Amp\onReadable()
. Amp\onWritable()
. Amp\onSignal()
. Amp\enable()
. Amp\disable()
. Amp\cancel()
2015-05-20 15:18:30 -04:00
Daniel Lowrey
fc600d46ab
Pass optional data parameter to when/watch callbacks
2015-05-19 18:49:38 -04:00
Daniel Lowrey
ca82ac5362
Fix NativeReactor bug breaking tick sleep timing
2015-05-19 16:13:53 -04:00
Daniel Lowrey
2a0486cb3c
Add Amp\pipe() function to pipe eventual results through a functor
2015-05-19 11:31:01 -04:00
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