Skip to content

Commit d9f8bbe

Browse files
author
Jamil Maqdis Anton
committed
refactor
1 parent 0b06738 commit d9f8bbe

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/Read.fs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,25 @@ type ReadingDirection =
1111

1212
module Read =
1313
let readFromStreamAsync: IStreamStore -> ReadingDirection -> StreamDetails -> int -> Async<ReadStreamPage> =
14-
fun store direction stream msgCount ->
15-
match direction with
16-
| Forward -> store.ReadStreamForwards(stream.streamName, stream.position, msgCount)
17-
| Backward -> store.ReadStreamBackwards(stream.streamName, stream.position, msgCount)
14+
fun store readingDirection streamDetails msgCount ->
15+
match readingDirection with
16+
| Forward -> store.ReadStreamForwards(streamDetails.streamName, streamDetails.position, msgCount)
17+
| Backward -> store.ReadStreamBackwards(streamDetails.streamName, streamDetails.position, msgCount)
1818
|> Async.AwaitTask
1919

2020
let readFromStreamAsync': IStreamStore -> ReadingDirection -> StreamDetails -> int -> CancellationToken -> Async<ReadStreamPage> =
21-
fun store direction stream msgCount cancellationToken ->
22-
match direction with
23-
| Forward -> store.ReadStreamForwards(stream.streamName, stream.position, msgCount, cancellationToken)
24-
| Backward -> store.ReadStreamBackwards(stream.streamName, stream.position, msgCount, cancellationToken)
21+
fun store readingDirection streamDetails msgCount cancellationToken ->
22+
match readingDirection with
23+
| Forward ->
24+
store.ReadStreamForwards(streamDetails.streamName, streamDetails.position, msgCount, cancellationToken)
25+
| Backward ->
26+
store.ReadStreamBackwards(streamDetails.streamName, streamDetails.position, msgCount, cancellationToken)
2527
|> Async.AwaitTask
2628

2729
module ReadExtras =
2830
let readStreamMessages: IStreamStore -> ReadingDirection -> StreamDetails -> int -> AsyncResult<List<StreamMessage>, string> =
29-
fun store direction stream msgCount ->
30-
Read.readFromStreamAsync store direction stream msgCount
31+
fun store readingDirection streamDetails msgCount ->
32+
Read.readFromStreamAsync store readingDirection streamDetails msgCount
3133
|> Async.bind (fun readStreamPage ->
3234
readStreamPage.Messages
3335
|> Seq.toList

0 commit comments

Comments
 (0)