Skip to content

Commit

Permalink
Comment version inferences
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Feb 19, 2020
1 parent f5a25b4 commit b63beca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Equinox.EventStore.Grpc/EventStoreGrpc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ module private Read =
let version =
match events with
| [||] when direction = Direction.Backwards -> -1L // When reading backwards, the startPos is End, which is not directly convertible
| [||] -> startPos.ToInt64()
| xs when direction = Direction.Backwards -> xs.[0].Event.EventNumber.ToInt64()
| xs -> xs.[xs.Length - 1].Event.EventNumber.ToInt64()
| [||] -> startPos.ToInt64() // e.g. if reading forward from (verified existing) event 10 and there are none, the version is still 10
| xs when direction = Direction.Backwards -> xs.[0].Event.EventNumber.ToInt64() // the events arrive backwards, so first is the 'version'
| xs -> xs.[xs.Length - 1].Event.EventNumber.ToInt64() // In normal case, the last event represents the version of the stream
return version, events
with :? StreamNotFoundException -> return -1L, [||] }

Expand Down

0 comments on commit b63beca

Please sign in to comment.