Skip to content

Commit

Permalink
initial v8 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Dec 22, 2018
1 parent 10c0eeb commit fe95a60
Show file tree
Hide file tree
Showing 134 changed files with 7,853 additions and 25 deletions.
52 changes: 27 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,46 @@ language: php
matrix:
fast_finish: true
include:
- php: 7.1
env:
- DEPENDENCIES=""
- EXECUTE_CS_CHECK=true
- TEST_COVERAGE=true
- php: 7.1
env:
- DEPENDENCIES="--prefer-lowest --prefer-stable"
- php: 7.2
env:
- DEPENDENCIES=""
- php: 7.2
env:
- DEPENDENCIES="--prefer-lowest --prefer-stable"
- php: 7.2
env:
- DEPENDENCIES=""
- EXECUTE_CS_CHECK=true
- TEST_COVERAGE=true
- php: 7.2
env:
- DEPENDENCIES="--prefer-lowest --prefer-stable"
- php: 7.3
env:
- DEPENDENCIES=""
- TEST_COVERAGE=true
- php: 7.3
env:
- DEPENDENCIES="--prefer-lowest --prefer-stable"

cache:
directories:
- $HOME/.composer/cache
- $HOME/.php-cs-fixer
- $HOME/.local
- $HOME/.composer/cache
- $HOME/.php-cs-fixer
- $HOME/.local

before_script:
- mkdir -p "$HOME/.php-cs-fixer"
- phpenv config-rm xdebug.ini
- composer self-update
- composer update --prefer-dist $DEPENDENCIES
- mkdir -p "$HOME/.php-cs-fixer"
- if php --ri xdebug >/dev/null; then phpenv config-rm xdebug.ini; fi
- composer self-update
- composer update --prefer-dist $DEPENDENCIES
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then composer require prooph/php-cs-fixer-config ^0.3; fi

script:
- if [[ $TEST_COVERAGE == 'true' ]]; then php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-clover ./build/logs/clover.xml; else ./vendor/bin/phpunit; fi
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then php -dzend_extension=xdebug.so ./vendor/bin/phpunit --exclude-group=ignore --coverage-text --coverage-clover ./build/logs/clover.xml; else ./vendor/bin/phpunit --exclude-group=ignore; fi
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run; fi

after_success:
- if [[ $TEST_COVERAGE == 'true' ]]; then php vendor/bin/coveralls -v; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then php vendor/bin/coveralls -v; fi

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/61c75218816eebde4486
- https://webhooks.gitter.im/e/61c75218816eebde4486
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Copyright (c) 2018-2018, prooph software GmbH
Copyright (c) 2018-2018, Sascha-Oliver Prolic
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the prooph software GmbH nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Prooph Event Store

Common classes and interface for Prooph Event Store implementations.

[![Build Status](https://travis-ci.org/prooph/event-store.svg?branch=master)](https://travis-ci.org/prooph/event-store)
[![Coverage Status](https://coveralls.io/repos/github/prooph/event-store/badge.svg?branch=master)](https://coveralls.io/github/prooph/event-store?branch=master)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/prooph/improoph)

## Installation

You can install prooph/event-store via composer by adding `"prooph/event-store": "dev-master"` as requirement to your composer.json.

### Available persistent implementations

- [Event Store Client](https://github.com/prooph/event-store-client) for async TCP connections
- [Event Store HTTP Client](https://github.com/prooph/event-http-store-client) for HTTP connections

## Documentation

See: [https://github.com/prooph/documentation](https://github.com/prooph/documentation)

Will be published on the website soon.

## Support

- Ask questions on Stack Overflow tagged with [#prooph](https://stackoverflow.com/questions/tagged/prooph).
- File issues at [https://github.com/prooph/event-store/issues](https://github.com/prooph/event-store/issues).
- Say hello in the [prooph gitter](https://gitter.im/prooph/improoph) chat.

## Contribute

Please feel free to fork and extend existing or add new plugins and send a pull request with your changes!
To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation.

## Version Guidance

| Version | Status | PHP Version | Support Until |
|---------|-------------|-------------|---------------|
| 5.x | EOL | >= 5.5 | EOL |
| 6.x | Maintained | >= 5.5 | 3 Dec 2017 |
| 7.x | Latest | >= 7.1 | active |
| 8.x | Development | >= 7.2 | active |

## License

Released under the [New BSD License](LICENSE).
54 changes: 54 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "prooph/event-store-",
"type": "library",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Sascha-Oliver Prolic",
"email": "saschaprolic@googlemail.com"
}
],
"description": "Event Store v8",
"keywords": [
"EventStore",
"EventSourcing",
"DDD",
"prooph"
],
"prefer-stable": true,
"require": {
"php": "^7.2",
"ext-json": "*",
"ramsey/uuid": "^3.7.3"
},
"require-dev": {
"amphp/amp": "^2.0.7",
"phpspec/prophecy": "^1.7",
"phpunit/phpunit": "^7.4",
"doctrine/instantiator": "^1.1",
"sebastian/object-enumerator": "^3.0.3",
"satooshi/php-coveralls": "^2.0"
},
"autoload": {
"psr-4": {
"Prooph\\EventStore\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"ProophTest\\EventStore\\": "tests/"
}
},
"scripts": {
"check": [
"@cs",
"@test"
],
"cs": "php-cs-fixer fix -v --diff --dry-run",
"cs-fix": "php-cs-fixer fix -v --diff",
"test": "phpunit"
},
"config": {
"sort-packages": true
}
}
36 changes: 36 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ This file is part of the prooph/event-store-client.
~ (c) 2018-2018 prooph software GmbH <contact@prooph.de>
~ (c) 2018-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
~
~ For the full copyright and license information, please view the LICENSE
~ file that was distributed with this source code.
-->

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
failOnWarning="true"
failOnRisky="true"
>
<testsuite name="Prooph EventStore Test Suite">
<directory suffix=".php">./tests</directory>
</testsuite>

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
26 changes: 26 additions & 0 deletions src/AllCheckpoint.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* This file is part of `prooph/event-store`.
* (c) 2018-2018 prooph software GmbH <contact@prooph.de>
* (c) 2018-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Prooph\EventStore;

/**
* This class contains constants to be used when setting up subscriptions
* using the EventStoreAsyncConnection::subscribeToAllFromAsync method
*/
class AllCheckpoint
{
/**
* Indicates that a catch-up subscription should receive all events in the database.
*/
public const ALL_START = null;
}
75 changes: 75 additions & 0 deletions src/AllEventsSlice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

/**
* This file is part of `prooph/event-store`.
* (c) 2018-2018 prooph software GmbH <contact@prooph.de>
* (c) 2018-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Prooph\EventStore;

class AllEventsSlice
{
/** @var ReadDirection */
private $readDirection;
/** @var Position */
private $fromPosition;
/** @var Position */
private $nextPosition;
/** @var ResolvedEvent[] */
private $events;
/** @var bool */
private $isEndOfStream;

/**
* @internal
*
* @param ReadDirection $readDirection
* @param Position $fromPosition
* @param Position $nextPosition
* @param ResolvedEvent[] $events
*/
public function __construct(
ReadDirection $readDirection,
Position $fromPosition,
Position $nextPosition,
array $events
) {
$this->readDirection = $readDirection;
$this->fromPosition = $fromPosition;
$this->nextPosition = $nextPosition;
$this->events = $events;
$this->isEndOfStream = \count($events) === 0;
}

public function readDirection(): ReadDirection
{
return $this->readDirection;
}

public function fromPosition(): Position
{
return $this->fromPosition;
}

public function nextPosition(): Position
{
return $this->nextPosition;
}

/** @return ResolvedEvent[] */
public function events(): array
{
return $this->events;
}

public function isEndOfStream(): bool
{
return $this->isEndOfStream;
}
}
25 changes: 25 additions & 0 deletions src/AsyncCatchUpSubscriptionDropped.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/**
* This file is part of `prooph/event-store`.
* (c) 2018-2018 prooph software GmbH <contact@prooph.de>
* (c) 2018-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Prooph\EventStore;

use Throwable;

interface AsyncCatchUpSubscriptionDropped
{
public function __invoke(
AsyncEventStoreCatchUpSubscription $subscription,
SubscriptionDropReason $reason,
?Throwable $exception = null
): void;
}
19 changes: 19 additions & 0 deletions src/AsyncEventStoreAllCatchUpSubscription.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/**
* This file is part of `prooph/event-store`.
* (c) 2018-2018 prooph software GmbH <contact@prooph.de>
* (c) 2018-2018 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Prooph\EventStore;

interface AsyncEventStoreAllCatchUpSubscription extends AsyncEventStoreCatchUpSubscription
{
public function lastProcessedPosition(): Position;
}
Loading

0 comments on commit fe95a60

Please sign in to comment.