Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] adds some first implementations #1

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

[WIP] adds some first implementations #1

wants to merge 17 commits into from

Conversation

oqq
Copy link
Member

@oqq oqq commented Feb 11, 2017

  • todos in code
  • add unit tests
  • some integration tests fails
  • performance would be bad
  • add persistence strategies
  • missing travis and cs fixer configs
  • missing doc headers
  • implement missing methods
  • enhance integration tests (with implementation)

@oqq oqq self-assigned this Feb 11, 2017
@oqq
Copy link
Member Author

oqq commented Feb 11, 2017

@codeliner @prolic @sandrokeil
First steps are done. ;)

$this->redisClient->zAdd('event_version:'.$streamNameKey, $aggregateVersion, $storageKey);

# todo: maybe we using a hash here?
$this->redisClient->set($storageKey, json_encode([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to set multiple events at once, to reduce overhead over the wire?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.. i have to use Lua scripts. Would be implemented with persistence strategies.
Also, how I understand it, if a transaction is started requests would only be done on commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I have no big knowledge of redis, but I compare it to a mysql example:

INSERT INTO foo (bar, baz) VALUES (1,2);
INSERT INTO foo (bar, baz) VALUES (2,4);
INSERT INTO foo (bar, baz) VALUES (3,6);

executed as single query-string (so there is only one request going over wire) is still much slower than:

INSERT INTO foo (bar, baz) VALUES (1,2), (2,4), (3,6);

if (false === $eventData) {
# todo: data for key was not found. Throw an exception?
throw new RuntimeException();
continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continue not needed, if exception is thrown

MetadataMatcher $metadataMatcher = null
): Iterator {
$streamNameKey = $this->getKeyFromStreamName($streamName);
$result = new \ArrayIterator();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is kind of bad - imagine you have 5mio events in a single stream - you would need to load all of them into memory. maybe something like https://github.com/prooph/pdo-event-store/blob/master/src/PdoStreamIterator.php should be used here.

Copy link
Member Author

@oqq oqq Feb 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.. I have started with yield but some tests would rewind the iterator. Redis has scan methods for batching.

Copy link
Member

@prolic prolic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work overall! 👍

@oqq
Copy link
Member Author

oqq commented Feb 12, 2017

@prolic i have add a travis configuration. Please activate the hook for travis in repository config.

@prolic
Copy link
Member

prolic commented Feb 12, 2017

@oqq coveralls, travis and packagist is created now.

@codeliner
Copy link
Member

great work @oqq Will review in detail next week

@prolic
Copy link
Member

prolic commented Feb 12, 2017

@oqq please note prooph/event-store#258 - some interface additions are done.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d7f9189 on develop into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 85c63b0 on develop into ** on master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 85c63b0 on develop into ** on master**.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants