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

MemoryStore: Fix Version for post-context in Equinox.Decider.TransactEx #296

Merged
merged 4 commits into from
Nov 10, 2021

Conversation

bartelink
Copy link
Collaborator

@bartelink bartelink commented Nov 2, 2021

Corrects MemoryStore's computation of the post-Version for use by Equinox.Decider.TransactEx
Refactors conflict case path to remove ugly use of Exception that I once assumed to be unavoidable

/// Represent a known array of events (without a known folded State)
let ofEventArray streamName fold initial (events: 'event array) = tokenOfArray streamName events, fold initial (Seq.ofArray events)
/// Represent a known array of Events together with the associated state
let ofEventArrayAndKnownState streamName fold (state: 'state) (events: 'event seq) = tokenOfSeq streamName events, fold state events
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note this computes an incorrect token as the event count is derived from the new events, not the post-state value of the events for this stream

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also an example of how confusing egregious use of |> is never a good thing (I try very hard not to do that as I'm conscious of it, but I evidently thought I was being very clever)

@bartelink
Copy link
Collaborator Author

bartelink commented Nov 2, 2021

Spotted during code review as I wondered whether SELECT was broken (it wasn't - the fundamentals of MemoryStore have good coverage, and the system I'm currently writing makes significant use of every nook and cranny...)

Aside: actual PEBKAC that made me find it

Estimated e -> {state with estimates = [| for x in state.estimates do if x.kind <> e.kind then x; e|] } 

^ does not do what I mean

@bartelink bartelink marked this pull request as ready for review November 2, 2021 15:50
@bartelink bartelink changed the title MemoryStore: Correct token generation MemoryStore: Fix Version for post-context in Equinox.Decider.TransactEx Nov 2, 2021
@bartelink bartelink merged commit 2e8d857 into master Nov 10, 2021
@bartelink bartelink deleted the memorystore-fixes branch November 10, 2021 11:49
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

Successfully merging this pull request may close these issues.

1 participant