Closed jmalloc closed 4 years ago
Rather than putting the offset in this new result type, we should place the same "item" slices (not the parcel slices) that appear in pipeline.Response
, that will help with #210 and eventually those slices can be removed from pipeline.Response
.
So generally the Transaction interface inside persistence
pkg would look like the following (including the new TransactionResult
type):
// Transaction exposes persistence operations that can be performed atomically.
// Transactions are not safe for concurrent use.
type Transaction interface {
aggregatestore.Transaction
eventstore.Transaction
queuestore.Transaction
offsetstore.Transaction
// Commit applies the changes from the transaction.
Commit(ctx context.Context) (TransactionResult, error)
// Rollback aborts the transaction.
Rollback() error
}
// TransactionResult is the result returned by Transaction.Commit() method.
type TransactionResult struct {
EventItems []*eventstore.Item
QueueItems []*queuestore.Item
}
Is this what you're thinking?
Yep, exactly!
Fixed by #235.
The transaction result would be returned from
Transaction.Commit()
on success, and include the offset of the first event saved within this transaction, if any.