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

Major change in stream expected version? #331

Open
semion-akimtsev opened this issue Nov 1, 2019 · 7 comments
Open

Major change in stream expected version? #331

semion-akimtsev opened this issue Nov 1, 2019 · 7 comments

Comments

@semion-akimtsev
Copy link

Hi @damianh ,

We have recently tried to upgrade to one of 1.2.x pre-release versions and got some unexpected behavior due to this change here

public const int NoStream = -3;
compared to version 1.1.x.
So it looks like there should be a major version change. What versioning strategy is applied to this repo?

@yreynhout
Copy link
Member

Are you using 1.2.x's ExpectedVersion with an older client (e.g. 1.1.x)? Or are you shipping the constant as part of another lib which you can't upgrade? What was the unexpected behavior (I suspect the reuse of -1)?

@semion-akimtsev
Copy link
Author

Well, as ExpectedVersion is an integer, the code which relies on this public contract made some assumptions about -1. After it was switched to 1.2.0-beta.6 some of the checks started to return different results.

@yreynhout
Copy link
Member

I've never really liked these as a constant nor as an integer - it should be opaque to the consumer and nobody should ever base decisions on the underlying value - it's a deficiency in SSS's type system. Alas, that ship has sailed for SSS, and so here we are.

@thefringeninja
Copy link
Member

thefringeninja commented Nov 4, 2019 via email

@semion-akimtsev
Copy link
Author

semion-akimtsev commented Nov 4, 2019

For now it looks to me that we cannot move on with this version as this is a breaking change, because a public API has been changed in a non-backwards compatible way. And it is not captured in this library's version if I would assume that it uses semantic versioning.

Use a value object in your application code and translate
before you call sql stream store

Could you please give an example?
IMO, since the API exposes a constant, I cannot imagine a way of wrapping it with anything which would not use an if() function of some sort (or directly expose the same value with a different name).

Aside of that, the ExpectedVersion type/contract mixes unrelated concerns together by introducing EmptyStream and NoStream. These have no relation to version. So I would argue that there is a need to introduce an entity called Stream which would have a set of properties exposed like bool=IsEmpty. NoStream does not fit into both approaches as it is neither a version nor a stream status, but probably is a part of a stream "accessor" interface.

@thefringeninja
Copy link
Member

thefringeninja commented Nov 4, 2019 via email

@yreynhout
Copy link
Member

I agree this is a breaking change in that an existing value was (re)used for a different purpose and constants being copied and embedded into consumers can make this painful. You can only move to this version if you are willing to recompile, yes.

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