-
Notifications
You must be signed in to change notification settings - Fork 74
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
Replace Envelope with Elem.SuccessElem #4629
Conversation
private def toIndexViewDef(envelope: Envelope[BlazegraphViewState]) = | ||
envelope.toElem { v => Some(v.project) }.traverse { v => | ||
private def toIndexViewDef(elem: Elem.SuccessElem[BlazegraphViewState]) = | ||
elem.withProject(elem.value.project).traverse { v => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't feel great that this is optional - most of the concrete types for which we're querying elems have a project and it's a mandatory field in the scoped tables. I guess it's because Envelope
was used for both global and scoped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's confusing how the elem wouldn't already have the project set since it's coming from within it..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to populate this field from the original SQL query.
Yes, it was because Envelope
and Elem
were designed to work for both global and scoped entities.
Not sure if there is still a use case for global entities though now that we got rid of the sse events for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was a stream of Envelopes, and what is a stream of SuccessElems?
private def toIndexViewDef(envelope: Envelope[BlazegraphViewState]) = | ||
envelope.toElem { v => Some(v.project) }.traverse { v => | ||
private def toIndexViewDef(elem: Elem.SuccessElem[BlazegraphViewState]) = | ||
elem.withProject(elem.value.project).traverse { v => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's confusing how the elem wouldn't already have the project set since it's coming from within it..?
72c45d8
to
3ef239e
Compare
610b02b
to
fcd7e86
Compare
Looking into why the project was optional led me to try to understand the usage of elem / envelope before... My feeling is it's used in places it shouldn't be which leads to incidental complexity like streams of
3 and 5 mean the project remains optional. I don't understand enough to comment on what should be used and where, but it's still pretty confusing in its current state. So I still can't really answer your question @shinyhappydan 😂 maybe @imsdu can! Also deleted a load of unused streaming methods from the event stores and logs. Probably enough for now! |
private def states(offset: Offset, strategy: RefreshStrategy): EnvelopeStream[S] = | ||
StreamingQuery[Envelope[S]]( | ||
private def states(offset: Offset, strategy: RefreshStrategy): Stream[IO, S] = | ||
StreamingQuery[GlobalStateValue[S]]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could use a tuple (S, Offset) here ?
Or make GlobalStateValue
private ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, less code!
Fixes #3745