Skip to content

Commit

Permalink
Merge 711849a into 0fbc6f2
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Jan 25, 2019
2 parents 0fbc6f2 + 711849a commit 11bc21a
Show file tree
Hide file tree
Showing 69 changed files with 430 additions and 428 deletions.
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -27,7 +27,8 @@
"amphp/byte-stream": "^1.5.1",
"amphp/file": "^0.3.3",
"amphp/socket": "^0.10.11",
"prooph/event-store": "dev-master",
"prooph/event-store": "dev-async",
"prooph/php-cs-fixer-config": "^0.3",
"ramsey/uuid": "^3.8"
},
"require-dev": {
Expand Down
14 changes: 7 additions & 7 deletions examples/demo-persistent-subscription-with-dns-cluster.php
Expand Up @@ -16,9 +16,9 @@
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
use Prooph\EventStore\AsyncEventStorePersistentSubscription;
use Prooph\EventStore\AsyncPersistentSubscriptionDropped;
use Prooph\EventStore\EventAppearedOnAsyncPersistentSubscription;
use Prooph\EventStore\Async\EventAppearedOnPersistentSubscription;
use Prooph\EventStore\Async\EventStorePersistentSubscription;
use Prooph\EventStore\Async\PersistentSubscriptionDropped;
use Prooph\EventStore\Exception\InvalidOperationException;
use Prooph\EventStore\Internal\PersistentSubscriptionCreateResult;
use Prooph\EventStore\PersistentSubscriptionSettings;
Expand Down Expand Up @@ -76,9 +76,9 @@
yield $connection->connectToPersistentSubscriptionAsync(
'foo-bar',
'test-persistent-subscription',
new class() implements EventAppearedOnAsyncPersistentSubscription {
new class() implements EventAppearedOnPersistentSubscription {
public function __invoke(
AsyncEventStorePersistentSubscription $subscription,
EventStorePersistentSubscription $subscription,
ResolvedEvent $resolvedEvent,
?int $retryCount = null
): Promise {
Expand All @@ -88,9 +88,9 @@ public function __invoke(
return new Success();
}
},
new class() implements AsyncPersistentSubscriptionDropped {
new class() implements PersistentSubscriptionDropped {
public function __invoke(
AsyncEventStorePersistentSubscription $subscription,
EventStorePersistentSubscription $subscription,
SubscriptionDropReason $reason,
?Throwable $exception = null
): void {
Expand Down
14 changes: 7 additions & 7 deletions examples/demo-persistent-subscription.php
Expand Up @@ -16,10 +16,10 @@
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
use Prooph\EventStore\AsyncEventStorePersistentSubscription;
use Prooph\EventStore\AsyncPersistentSubscriptionDropped;
use Prooph\EventStore\Async\EventAppearedOnPersistentSubscription;
use Prooph\EventStore\Async\EventStorePersistentSubscription;
use Prooph\EventStore\Async\PersistentSubscriptionDropped;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventAppearedOnAsyncPersistentSubscription;
use Prooph\EventStore\Exception\InvalidOperationException;
use Prooph\EventStore\Internal\PersistentSubscriptionCreateResult;
use Prooph\EventStore\PersistentSubscriptionSettings;
Expand Down Expand Up @@ -69,9 +69,9 @@
yield $connection->connectToPersistentSubscriptionAsync(
'foo-bar',
'test-persistent-subscription',
new class() implements EventAppearedOnAsyncPersistentSubscription {
new class() implements EventAppearedOnPersistentSubscription {
public function __invoke(
AsyncEventStorePersistentSubscription $subscription,
EventStorePersistentSubscription $subscription,
ResolvedEvent $resolvedEvent,
?int $retryCount = null
): Promise {
Expand All @@ -81,9 +81,9 @@ public function __invoke(
return new Success();
}
},
new class() implements AsyncPersistentSubscriptionDropped {
new class() implements PersistentSubscriptionDropped {
public function __invoke(
AsyncEventStorePersistentSubscription $subscription,
EventStorePersistentSubscription $subscription,
SubscriptionDropReason $reason,
?Throwable $exception = null
): void {
Expand Down
20 changes: 10 additions & 10 deletions examples/demo-subscribe-to-all-from.php
Expand Up @@ -16,12 +16,12 @@
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
use Prooph\EventStore\AsyncCatchUpSubscriptionDropped;
use Prooph\EventStore\AsyncEventStoreCatchUpSubscription;
use Prooph\EventStore\Async\CatchUpSubscriptionDropped;
use Prooph\EventStore\Async\EventAppearedOnCatchupSubscription;
use Prooph\EventStore\Async\EventStoreCatchUpSubscription;
use Prooph\EventStore\Async\LiveProcessingStartedOnCatchUpSubscription;
use Prooph\EventStore\CatchUpSubscriptionSettings;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventAppearedOnAsyncCatchupSubscription;
use Prooph\EventStore\LiveProcessingStartedOnAsyncCatchUpSubscription;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropReason;
use Prooph\EventStore\UserCredentials;
Expand All @@ -47,9 +47,9 @@
yield $connection->subscribeToAllFromAsync(
null,
CatchUpSubscriptionSettings::default(),
new class() implements EventAppearedOnAsyncCatchupSubscription {
new class() implements EventAppearedOnCatchupSubscription {
public function __invoke(
AsyncEventStoreCatchUpSubscription $subscription,
EventStoreCatchUpSubscription $subscription,
ResolvedEvent $resolvedEvent): Promise
{
echo 'incoming event: ' . $resolvedEvent->originalEventNumber() . '@' . $resolvedEvent->originalStreamName() . PHP_EOL;
Expand All @@ -58,15 +58,15 @@ public function __invoke(
return new Success();
}
},
new class() implements LiveProcessingStartedOnAsyncCatchUpSubscription {
public function __invoke(AsyncEventStoreCatchUpSubscription $subscription): void
new class() implements LiveProcessingStartedOnCatchUpSubscription {
public function __invoke(EventStoreCatchUpSubscription $subscription): void
{
echo 'liveProcessingStarted on <all>' . PHP_EOL;
}
},
new class() implements AsyncCatchUpSubscriptionDropped {
new class() implements CatchUpSubscriptionDropped {
public function __invoke(
AsyncEventStoreCatchUpSubscription $subscription,
EventStoreCatchUpSubscription $subscription,
SubscriptionDropReason $reason,
?Throwable $exception = null
): void {
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-subscribe-to-all.php
Expand Up @@ -16,8 +16,8 @@
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
use Prooph\EventStore\Async\EventAppearedOnSubscription;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventAppearedOnAsyncSubscription;
use Prooph\EventStore\EventStoreSubscription;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropped;
Expand Down Expand Up @@ -45,7 +45,7 @@

$subscription = yield $connection->subscribeToAllAsync(
true,
new class() implements EventAppearedOnAsyncSubscription {
new class() implements EventAppearedOnSubscription {
public function __invoke(
EventStoreSubscription $subscription,
ResolvedEvent $resolvedEvent): Promise
Expand Down
13 changes: 7 additions & 6 deletions examples/demo-subscribe-to-stream-from-with-logger.php
Expand Up @@ -16,11 +16,12 @@
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
use Prooph\EventStore\AsyncEventStoreCatchUpSubscription;
use Prooph\EventStore\Async\EventAppearedOnSubscription;
use Prooph\EventStore\Async\EventStoreCatchUpSubscription;
use Prooph\EventStore\Async\LiveProcessingStartedOnCatchUpSubscription;
use Prooph\EventStore\CatchUpSubscriptionSettings;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventAppearedOnAsyncSubscription;
use Prooph\EventStore\EventStoreSubscription;
use Prooph\EventStore\LiveProcessingStartedOnAsyncCatchUpSubscription;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropped;
use Prooph\EventStore\SubscriptionDropReason;
Expand Down Expand Up @@ -52,7 +53,7 @@
'foo-bar',
null,
CatchUpSubscriptionSettings::default(),
new class() implements EventAppearedOnAsyncSubscription {
new class() implements EventAppearedOnSubscription {
public function __invoke(
EventStoreSubscription $subscription,
ResolvedEvent $resolvedEvent): Promise
Expand All @@ -63,8 +64,8 @@ public function __invoke(
return new Success();
}
},
new class() implements LiveProcessingStartedOnAsyncCatchUpSubscription {
public function __invoke(AsyncEventStoreCatchUpSubscription $subscription): void
new class() implements LiveProcessingStartedOnCatchUpSubscription {
public function __invoke(EventStoreCatchUpSubscription $subscription): void
{
echo 'liveProcessingStarted on ' . $subscription->streamId() . PHP_EOL;
}
Expand Down
20 changes: 10 additions & 10 deletions examples/demo-subscribe-to-stream-from.php
Expand Up @@ -16,12 +16,12 @@
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
use Prooph\EventStore\AsyncCatchUpSubscriptionDropped;
use Prooph\EventStore\AsyncEventStoreCatchUpSubscription;
use Prooph\EventStore\Async\CatchUpSubscriptionDropped;
use Prooph\EventStore\Async\EventAppearedOnCatchupSubscription;
use Prooph\EventStore\Async\EventStoreCatchUpSubscription;
use Prooph\EventStore\Async\LiveProcessingStartedOnCatchUpSubscription;
use Prooph\EventStore\CatchUpSubscriptionSettings;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventAppearedOnAsyncCatchupSubscription;
use Prooph\EventStore\LiveProcessingStartedOnAsyncCatchUpSubscription;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropReason;
use Throwable;
Expand All @@ -47,9 +47,9 @@
'foo-bar',
null,
CatchUpSubscriptionSettings::default(),
new class() implements EventAppearedOnAsyncCatchupSubscription {
new class() implements EventAppearedOnCatchupSubscription {
public function __invoke(
AsyncEventStoreCatchUpSubscription $subscription,
EventStoreCatchUpSubscription $subscription,
ResolvedEvent $resolvedEvent
): Promise {
echo 'incoming event: ' . $resolvedEvent->originalEventNumber() . '@' . $resolvedEvent->originalStreamName() . PHP_EOL;
Expand All @@ -58,15 +58,15 @@ public function __invoke(
return new Success();
}
},
new class() implements LiveProcessingStartedOnAsyncCatchUpSubscription {
public function __invoke(AsyncEventStoreCatchUpSubscription $subscription): void
new class() implements LiveProcessingStartedOnCatchUpSubscription {
public function __invoke(EventStoreCatchUpSubscription $subscription): void
{
echo 'liveProcessingStarted on ' . $subscription->streamId() . PHP_EOL;
}
},
new class() implements AsyncCatchUpSubscriptionDropped {
new class() implements CatchUpSubscriptionDropped {
public function __invoke(
AsyncEventStoreCatchUpSubscription $subscription,
EventStoreCatchUpSubscription $subscription,
SubscriptionDropReason $reason,
?Throwable $exception = null
): void {
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-subscribe-to-stream.php
Expand Up @@ -16,8 +16,8 @@
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
use Prooph\EventStore\Async\EventAppearedOnSubscription;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\EventAppearedOnAsyncSubscription;
use Prooph\EventStore\EventStoreSubscription;
use Prooph\EventStore\ResolvedEvent;
use Prooph\EventStore\SubscriptionDropped;
Expand Down Expand Up @@ -46,7 +46,7 @@
$subscription = yield $connection->subscribeToStreamAsync(
'foo-bar',
true,
new class() implements EventAppearedOnAsyncSubscription {
new class() implements EventAppearedOnSubscription {
public function __invoke(
EventStoreSubscription $subscription,
ResolvedEvent $resolvedEvent): Promise
Expand Down
12 changes: 6 additions & 6 deletions src/ClientOperations/StartTransactionOperation.php
Expand Up @@ -14,13 +14,13 @@
namespace Prooph\EventStoreClient\ClientOperations;

use Amp\Deferred;
use Prooph\EventStore\AsyncEventStoreTransaction;
use Prooph\EventStore\Async\EventStoreTransaction;
use Prooph\EventStore\Async\Internal\EventStoreTransactionConnection;
use Prooph\EventStore\Exception\AccessDenied;
use Prooph\EventStore\Exception\InvalidTransaction;
use Prooph\EventStore\Exception\StreamDeleted;
use Prooph\EventStore\Exception\UnexpectedOperationResult;
use Prooph\EventStore\Exception\WrongExpectedVersion;
use Prooph\EventStore\Internal\AsyncEventStoreTransactionConnection;
use Prooph\EventStore\UserCredentials;
use Prooph\EventStoreClient\Messages\ClientMessages\OperationResult;
use Prooph\EventStoreClient\Messages\ClientMessages\TransactionStart;
Expand All @@ -40,7 +40,7 @@ class StartTransactionOperation extends AbstractOperation
private $stream;
/** @var int */
private $expectedVersion;
/** @var AsyncEventStoreTransactionConnection */
/** @var EventStoreTransactionConnection */
protected $parentConnection;

public function __construct(
Expand All @@ -49,7 +49,7 @@ public function __construct(
bool $requireMaster,
string $stream,
int $expectedVersion,
AsyncEventStoreTransactionConnection $parentConnection,
EventStoreTransactionConnection $parentConnection,
?UserCredentials $userCredentials
) {
$this->requireMaster = $requireMaster;
Expand Down Expand Up @@ -116,11 +116,11 @@ protected function inspectResponse(ProtobufMessage $response): InspectionResult
}
}

protected function transformResponse(ProtobufMessage $response): AsyncEventStoreTransaction
protected function transformResponse(ProtobufMessage $response): EventStoreTransaction
{
\assert($response instanceof TransactionStartCompleted);

return new AsyncEventStoreTransaction(
return new EventStoreTransaction(
$response->getTransactionId(),
$this->credentials,
$this->parentConnection
Expand Down
12 changes: 6 additions & 6 deletions src/EventStoreConnectionFactory.php
Expand Up @@ -13,7 +13,7 @@

namespace Prooph\EventStoreClient;

use Prooph\EventStore\AsyncEventStoreConnection;
use Prooph\EventStore\Async\EventStoreConnection;
use Prooph\EventStore\EndPoint;
use Prooph\EventStore\Exception\InvalidArgumentException;
use Prooph\EventStoreClient\Internal\ClusterDnsEndPointDiscoverer;
Expand All @@ -27,7 +27,7 @@ public static function createFromConnectionString(
string $connectionString,
?ConnectionSettings $settings = null,
?string $connectionName = null
): AsyncEventStoreConnection {
): EventStoreConnection {
$settings = ConnectionString::getConnectionSettings(
$connectionString,
$settings ?? ConnectionSettings::default()
Expand All @@ -54,7 +54,7 @@ public static function createFromUri(
?Uri $uri,
?ConnectionSettings $connectionSettings = null,
?string $connectionName = null
): AsyncEventStoreConnection {
): EventStoreConnection {
$connectionSettings = $connectionSettings ?? ConnectionSettings::default();

if (null !== $uri) {
Expand Down Expand Up @@ -170,7 +170,7 @@ public static function createFromEndPoint(
EndPoint $endPoint,
?ConnectionSettings $settings = null,
?string $connectionName = null
): AsyncEventStoreConnection {
): EventStoreConnection {
$settings = $settings ?? ConnectionSettings::default();

return new EventStoreNodeConnection(
Expand All @@ -187,15 +187,15 @@ public static function createFromEndPoint(
public static function createFromSettings(
ConnectionSettings $settings,
?string $connectionName = null
): AsyncEventStoreConnection {
): EventStoreConnection {
return self::createFromUri(null, $settings, $connectionName);
}

public static function createFromClusterSettings(
ConnectionSettings $connectionSettings,
ClusterSettings $clusterSettings,
string $connectionName = ''
): AsyncEventStoreConnection {
): EventStoreConnection {
$endPointDiscoverer = new ClusterDnsEndPointDiscoverer(
$connectionSettings->log(),
$clusterSettings->clusterDns(),
Expand Down

0 comments on commit 11bc21a

Please sign in to comment.