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

RFC problem with TransactionalEventStore and ArangoDB #221

Closed
sandrokeil opened this issue Nov 22, 2016 · 3 comments
Closed

RFC problem with TransactionalEventStore and ArangoDB #221

sandrokeil opened this issue Nov 22, 2016 · 3 comments

Comments

@sandrokeil
Copy link
Member

I see some problems with TransactionalEventStore interface and ArangoDB or other event store implementations who handles transactions in another way. ArangoDB has no beginTransaction, commit, rollback or isInTransaction see docs.

Can we achieve more interoperability by simply using a function e.g. executeTransaction which gets a list of streams? But we have to differ between create and appendTo. Maybe instead of using create and appendTo methods, we introduce a stream type which can be create or appendTo, so the provided stream list can be executed in order.

/cc @prolic @codeliner

@codeliner
Copy link
Member

Can't we handle the logic behind the TransactionalEventStore interface?
ArangoDB handles transactions in one go but IMHO this is implementation detail. From a user POV it makes no difference:

$arangoDbES->beginTransaction();
//$this->inTransaction = true;
$arangoDbES->create($stream);
//$this->transactionOperations[] = new ArangoCreateStreamOperation($stream);
$arangoDbES->appendTo($streamName, $streamEvents);
//$this->transactionOperations[] = new ArangoAppendToStreamOperation($streamName, $streamEvents);
$arangoDbES->commit();
//$this->executeTransaction();
//foreach($this->transactionOperations as $op) {/*map to transaction description*/}
//$this->arangoConnection->transaction($transactionDescription); 

//or in case of a userland error before $arangoDbES->commit() is called
try {
//do something that causes an error
} catch (\Throwable $error) {
  if ($arangoDbES->isInTransaction()) { //return $this->inTransaction;
    $arangoDbES->rollback();
    //$this->transactionOperations = [];
    //$this->inTransaction = false;
  }
}

@sandrokeil
Copy link
Member Author

Yes that should be possible. It's only confusing if you have to use these methods and read in the ArangoDB docs, transaction is handled in one go.

@prolic
Copy link
Member

prolic commented Dec 26, 2016

@sandrokeil can we close this now?

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

No branches or pull requests

3 participants