-
Notifications
You must be signed in to change notification settings - Fork 124
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
EmptyStream value inconsistency vs EventStore #332
Comments
Then other inconsistency to note is that ES lib versions >=4 use a |
I would use a value object in your code to wrap this value. These are magic
numbers and probably do not belong on any public api.
…On Sat, Nov 2, 2019 at 11:04 PM Ruben Bartelink ***@***.***> wrote:
In the course of jet/equinox#168 <jet/equinox#168>,
I tripped up during some direct porting of a library that wraps EventStore.
The item in question is the naming and values of the Version special values
(this applies in 1.2.0-beta4/6)
1. ES has deprecated EmptyStream in favour of NoStream
https://github.com/EventStore/EventStore/blob/03435307176cc7118a0d76657df9f87a47eb8c00/src/EventStore.ClientAPI/ExpectedVersion.cs#L27
2. SSS still has both
https://github.com/SQLStreamStore/SQLStreamStore/blob/6f688d42e34976bf1b047eed396125d02b750143/src/SqlStreamStore/Streams/ExpectedVersion.cs#L12
3. *BUT the SSS NoStream is -3 and the ES one is -1*
This happens to cause me a problem as I need the value to be -1 for
some formulae to not be off by 2...
I've special cased things, but ideally the names or values would either
converge or have a name that makes you think ?
related #331 <#331>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#332?email_source=notifications&email_token=AADY7B2UCVAO6SY5NHTD4JLQRX2NBA5CNFSM4JIIP232YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HWMYYRQ>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADY7B6I6P2DO5DFA5QAT7LQRX2NBANCNFSM4JIIP23Q>
.
--
Sent from my regular computer
http://twitter.com/thefringeninja
http://www.thefringeninja.com/
|
TL;DR my problem is that the API is surprising and one can easily make a mistake when porting from ES to SSS. Yes, I know most go the other direction, but that really isn't the point. I can't think of a way to express "you're not making any sense" without pretty much regurgitating the above Your answer still leaves my concerns as described above unsolved:
An example of something that would solve the problem is to deprecate EmptyStream and NoStream in SSS and replace with something new which removes the two problems, viz:
|
Something we are doing in eventstore for v6 is to introduce a value object
to represent "AnyStreamRevision":
https://github.com/thefringeninja/EventStore/blob/grpc/src/EventStore.Grpc.Common/AnyStreamRevision.cs
The magic numbers are still there, however they will not be represented
that way on the wire:
https://github.com/thefringeninja/EventStore/blob/grpc/src/Protos/Grpc/streams.proto#L109
…On Mon, Nov 4, 2019 at 10:33 AM Ruben Bartelink ***@***.***> wrote:
TL;DR my problem is that the API is surprising and one can easily make a
mistake when porting from ES to SSS. Yes, I know most go the other
direction, but that really isn't the point. I can't think of a way to
express "you're not making any sense" without pretty much regurgitating the
above
Your answer still leaves my concerns as described above unsolved:
- (probably too late to change but) avoidable differences in value of
the same constant between SSS and ES which mean more special casing vs the
ES API because math: [the ES value] of -1 actually makes sense if we
are to represent an ExpectedVersion as a Version Number - i.e. when we have
0 events, the version is -1, when we have 2, the value is 1
- (this is fixable) the one that ES and SSS have in common is
deprecated in ES
- the types between ES and SSS are Int32 vs Int64 (suggesting SSS
should go int64 for simiplicity)
An example of something that would solve the problem is to deprecate
EmptyStream and NoStream in SSS and replace with something new which
removes the two problems, viz:
1. the SSS value of NoStream is different to the ES one
2. the maths doesnt work if NoStream <> -1
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#332?email_source=notifications&email_token=AADY7BYBT6XUTN4MTDINF5TQR7T43A5CNFSM4JIIP232YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC6UVOA#issuecomment-549276344>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADY7B67MZMFK4VLEFYID5LQR7T43ANCNFSM4JIIP23Q>
.
--
Sent from my regular computer
http://twitter.com/thefringeninja
http://www.thefringeninja.com/
|
Right - I agree that's a much clearer way to model it; thanks for taking the time to make it concrete for me If SSS v2 was to present Right now, SSS requires an IME people like representing ExpectedVersion as an integer and it works well for a heck of a lot of cases. If we didnt have the legacy of ES having My problem/the inconsistency I'm calling out: a) the current ES way of doing that:
b) the SSS ways of doing that:
My bottom line is that
To cut a long story short: if some future SSS v2 design can force people away from this potential bug and align with an ES v6 API, that'd be great. |
In the course of jet/equinox#168, I tripped up during some direct porting of a library that wraps EventStore. The item in question is the naming and values of the Version special values (this applies in 1.2.0-beta4/6)
SQLStreamStore/src/SqlStreamStore/Streams/ExpectedVersion.cs
Line 12 in 6f688d4
This happens to cause me a problem as I need the value to be -1 for some formulae to not be off by 2...
I've special cased things, but ideally the names or values would either converge or have a name that makes you think ?
related #331
The text was updated successfully, but these errors were encountered: