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

134 Commits

Author SHA1 Message Date
Bob Weinand
ac116c93b8 Fix missing return inside Loop::info() 2016-05-23 19:06:07 +02:00
Niklas Keller
706bdfa632 Move from keep_alive to watchers array 2016-05-23 19:06:07 +02:00
Niklas Keller
ae36a2011d Add Loop::info, resolves #44 2016-05-23 19:06:07 +02:00
Andrew Carter
8feb808fe8 Merge pull request #57 from async-interop/consistent-repeat-delay-param-order
Put $delay and $interval at the first places of their respective methods
2016-05-22 17:42:51 +01:00
Bob Weinand
d0701c20d3 Put $delay and $interval at the first places of their respective methods
Closes #54
2016-05-22 18:07:21 +02:00
Bob Weinand
4dce408678 Fix accidental static on LoopDriver::getHandle() 2016-05-22 15:47:41 +02:00
Bob Weinand
eb242de2fb Merge pull request #56 from async-interop/drop-feature-constants
Drop feature constant
2016-05-22 15:35:59 +02:00
Niklas Keller
8418c37d53 Drop feature constant, leftover from #50 2016-05-22 15:34:29 +02:00
Andrew Carter
f2fca2e0a3 Merge pull request #51 from async-interop/supports
Drop Loop::supports
2016-05-22 14:26:41 +01:00
Niklas Keller
1f526a5cf0 Drop Loop::supports
Redefine UnsupportedFeatureException to be only thrown if the system
doesn't support the feature. Drivers MUST support it if PCNTL or something
similar is available.
2016-05-21 13:38:36 +02:00
Bob Weinand
a80e109027 Merge pull request #52 from async-interop/rdlowrey
Add Daniel Lowrey to Contributors
2016-05-21 13:31:56 +02:00
Niklas Keller
36fdb6dec1 Add Daniel Lowrey to Contributors 2016-05-21 13:13:51 +02:00
Niklas Keller
8a84f70784 Merge pull request #48 from async-interop/underlying-loop-handle
Add getLoopHandle() for accessing the underlying loop
2016-05-21 09:45:54 +02:00
Bob Weinand
a020880d53 getLoopHandle() => getHandle() on Driver only 2016-05-21 01:32:03 +02:00
Bob Weinand
07d3408743 All hail the Lord FIG
SIGH!
2016-05-20 13:02:31 +02:00
Bob Weinand
13c93afca4 Merge pull request #30 from async-interop/factory
Add LoopDriverFactory
2016-05-20 12:59:21 +02:00
Niklas Keller
1c1e740392 Improve factory error messages 2016-05-20 10:06:50 +02:00
Niklas Keller
f890d37e80 Use default registry to support sync wait, fix error messages 2016-05-20 10:06:50 +02:00
Niklas Keller
665cc7fc5b Instantiate driver if none exists upon Loop::setFactory to support sync waits 2016-05-20 10:06:50 +02:00
Niklas Keller
f66cb4a66f Check that factory returns an instance of LoopDriver 2016-05-20 10:06:50 +02:00
Niklas Keller
30254b2a36 Change namespace of LoopDriverFactory 2016-05-20 10:06:50 +02:00
Niklas Keller
bf1d42365f Fix createDriver call to be static 2016-05-20 10:06:50 +02:00
Niklas Keller
0e4194bfe8 Add LoopDriverFactory
The LoopDriverFactory SHOULD be used by driver implementations
to set a default event loop driver.

This can be achieved by having a Composer autoloader like that:

{
    "autoload": {
        "files": ["src/bootstrap.php"]
    }
}

Where src/bootstrap.php contains the following code:

use Interop\Async\EventLoop\LoopDriverFactory;

class MyDriverFactory implements LoopDriverFactory
{
    public function create()
    {
        return new MyDriver();
    }
}

Loop::setFactory(new MyDriverFactory());

This ensures the user doesn't have to care about setting the actual
driver. A user just has to require the specific event loop driver
package he / she wants to use.
2016-05-20 10:06:50 +02:00
Andrew Carter
662cfdc045 Merge pull request #49 from async-interop/travis
Add Travis configuration
2016-05-20 09:03:15 +01:00
Niklas Keller
2530ff0efe Add HHVM to Travis 2016-05-20 09:41:25 +02:00
Niklas Keller
6794dd8e9c Remove now standard --installed flag for 'composer show' 2016-05-20 09:41:25 +02:00
Niklas Keller
32597c4491 Don't delete xdebug config, so we have coverage data for PHP 5 2016-05-20 09:41:25 +02:00
Niklas Keller
88d65a5caa Add Travis configuration 2016-05-20 09:41:25 +02:00
Cees-Jan Kiewiet
c258d67969 Merge pull request #45 from async-interop/single-on-error-handler
Changed onError() to setErrorHandler()
2016-05-20 09:40:06 +02:00
Andrew Carter
23284e56f1 Changed onError() to setErrorHandler()
Previously this code allowed multiple error handlers. This change
would allow for only a single error handler that is overwritten by
future calls and can be cleared by passing a null parameter.
2016-05-20 09:31:56 +02:00
Bob Weinand
6a13263198 Merge pull request #35 from trowski/watcher-data
Add watcher data parameter
2016-05-19 17:42:54 +02:00
Aaron Piotrowski
ffde57f0d1 Make watcher ID first parameter 2016-05-19 10:30:38 -05:00
Bob Weinand
78de0c947b Merge pull request #31 from async-interop/registry
Add loop bound state registry
2016-05-19 12:40:37 +02:00
Bob Weinand
d03a2c14e6 Add getLoopHandle() for accessing the underlying loop
These resources or objects may then be attributed to a specific extension via instanceof or get_resource_type() in implementations.

Fixes #16.
2016-05-19 01:12:56 +02:00
Niklas Keller
3992374209 Apply ugly FIG braces style 2016-05-16 11:33:58 +02:00
Niklas Keller
54915e31bc Add phpunit to require-dev again 2016-05-16 11:33:04 +02:00
Niklas Keller
698d292d2c Add test to autoload-dev 2016-05-16 11:02:14 +02:00
Niklas Keller
8b3555c552 Change namespace of Registry 2016-05-16 11:02:14 +02:00
Niklas Keller
2555defa58 Fixup registry reset after execution of the loop 2016-05-16 11:02:13 +02:00
Niklas Keller
679651b242 Refactor Registry into a trait, so it can be tested separately 2016-05-16 11:02:13 +02:00
Niklas Keller
333a9daf5a Add loop bound state registry
The registry allows to store information bound to a specific loop.
This can be useful to store state of globals like a DNS resolver.

Rationale for a global DNS resolver:

Nobody wants to inject a resolver into everything that does some sort of I/O.
Using IP addresses everywhere instead of hostnames also doesn't make sense.

Therefore there should be a global default DNS resolver. But this resolver
needs a read watcher for the response. If the loop gets swapped and a DNS
request is made, the resolver would never get the read event, since the
stream is only watched in the old loop. The resolver also doesn't get any
info about the loop swap, so it can't use a new watcher.

With a loop bound registry, it can just store the connection in the loop and
will use a new connection when the loop is swapped, because the state doesn't
exist any longer. Once the loop is put back, it can use the old connection
again.

This API should only be used by real global objects. Most packages won't need
to use this API, but it's required for the mentioned use cases.
2016-05-16 11:02:13 +02:00
Andrew Carter
30fc5464cc Merge pull request #38 from async-interop/description
Change package description to include 'for interoperability'
2016-05-16 10:00:08 +01:00
Niklas Keller
017f1d2149 Change package description to include 'for interoperability' 2016-05-15 17:21:56 +02:00
Bob Weinand
ff9d6fb61d Merge pull request #36 from async-interop/namespace
Shorten namespace to Interop\Async and correct PHP version requirement
2016-05-15 16:51:59 +02:00
Niklas Keller
992b3e4e5a Remove 'for interoperability' from the description 2016-05-15 16:47:51 +02:00
Niklas Keller
a32c1c36d2 Shorten namespace to Interop\Async and correct PHP version requirement 2016-05-15 14:40:07 +02:00
Aaron Piotrowski
d5126870c4 Event -> Watcher
Methods return watchers for events, not events.
2016-05-14 17:19:05 -05:00
Aaron Piotrowski
5b283d69e9 Define watcher callback signatures 2016-05-14 17:14:33 -05:00
Aaron Piotrowski
38a3da4889 Add $data parameter to watchers 2016-05-14 17:13:35 -05:00
Andrew Carter
95c2f35e60 Merge pull request #32 from async-interop/support
Add Loop::supports to check for optional features
2016-05-14 16:59:17 +01:00