Werner
Werner

Reputation: 1311

JOlivier EventStore difference and usage of StreamRevision and CommitSequence?

When looking to JOlivers "EventStore", I see that StreamRevision and CommitSequence are the same if you only commit 1 event. And it is the StreamRevision that is used to select events with.

Suppose I first created an aggregate which comitted 1 event. And after that comitted 10 events which would make my SQL database table look like this (simplified):

Revision    Items   Sequence
1           1       1   
11          10      2

I have 2 question that derive from this:

  1. Is this the difference between StreamRevision and CommitSequence?

  2. The store exposes a "GetFrom" method that takes a "minRevision" and a "maxRevision". With the data from above, how does this work if I request minRevision=4 and maxRevision=8 ? Shouldn't it have been "minSequence" and "maxSequence" instead?

Thanks.

Werner

Upvotes: 3

Views: 398

Answers (1)

Jonathan Oliver
Jonathan Oliver

Reputation: 5267

Commits are a storage concept to prevent duplicates and facilitate optimistic concurrency by storage engines that don't have transactional support such as CouchDB and MongoDB. StreamRevision, on the other hand, represents the number of events committed to the stream.

When you're working with stream and you call GetFrom() with min/max revision of 4-8, that means that you want (according to your example) all events starting at v4 through v8 which is encapsulated by commit #2.

Upvotes: 1

Related Questions