开发者

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 maxRev开发者_如何转开发ision=8 ? Shouldn't it have been "minSequence" and "maxSequence" instead?

Thanks.

Werner


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜