Skip to content

Commit 47d117f

Browse files
author
Jamil Maqdis Anton
committed
Add docs. Change exception type.
1 parent 37c82be commit 47d117f

File tree

1 file changed

+54
-40
lines changed

1 file changed

+54
-40
lines changed

src/ReadRaw.fs

Lines changed: 54 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ module ReadRaw =
2424
| StartPosition.Any -> -1L
2525
| StartPosition.SpecificPosition position -> position
2626

27+
/// Read forwards from the all stream.
28+
/// Can throw exceptions.
2729
let allForwards (store: SqlStreamStore.IStreamStore)
2830
(startPositionInclusive: StartPosition)
2931
(msgCount: int)
@@ -33,6 +35,8 @@ module ReadRaw =
3335
|> Async.awaitTaskWithInnerException
3436
}
3537

38+
/// Read backwards from the all stream.
39+
/// Can throw exceptions.
3640
let allBackwards (store: SqlStreamStore.IStreamStore)
3741
(startPositionInclusive: StartPosition)
3842
(msgCount: int)
@@ -42,6 +46,8 @@ module ReadRaw =
4246
|> Async.awaitTaskWithInnerException
4347
}
4448

49+
/// Read forwards from a specific stream.
50+
/// Can throw exceptions.
4551
let streamForwards (store: SqlStreamStore.IStreamStore)
4652
(streamName: string)
4753
(readVersion: ReadVersion)
@@ -52,6 +58,8 @@ module ReadRaw =
5258
|> Async.awaitTaskWithInnerException
5359
}
5460

61+
/// Read backwards from a specific stream.
62+
/// Can throw exceptions.
5563
let streamBackwards (store: SqlStreamStore.IStreamStore)
5664
(streamName: string)
5765
(readVersion: ReadVersion)
@@ -62,6 +70,8 @@ module ReadRaw =
6270
|> Async.awaitTaskWithInnerException
6371
}
6472

73+
/// Read forwards from the all stream, prefetching the messages' jsonData.
74+
/// Can throw exceptions.
6575
let allForwardsPrefetch (store: SqlStreamStore.IStreamStore)
6676
(startPositionInclusive: StartPosition)
6777
(msgCount: int)
@@ -73,6 +83,8 @@ module ReadRaw =
7383
|> Async.awaitTaskWithInnerException
7484
}
7585

86+
/// Read backwards from the all stream, prefetching the messages' jsonData.
87+
/// Can throw exceptions.
7688
let allBackwardsPrefetch (store: SqlStreamStore.IStreamStore)
7789
(startPositionInclusive: StartPosition)
7890
(msgCount: int)
@@ -84,6 +96,8 @@ module ReadRaw =
8496
|> Async.awaitTaskWithInnerException
8597
}
8698

99+
/// Read forwards from a specific stream, prefetching the messages' jsonData.
100+
/// Can throw exceptions.
87101
let streamForwardsPrefetch (store: SqlStreamStore.IStreamStore)
88102
(streamName: string)
89103
(readVersion: ReadVersion)
@@ -96,6 +110,8 @@ module ReadRaw =
96110
|> Async.awaitTaskWithInnerException
97111
}
98112

113+
/// Read backwards from a specific stream, prefetching the messages' jsonData.
114+
/// Can throw exceptions.
99115
let streamBackwardsPrefetch (store: SqlStreamStore.IStreamStore)
100116
(streamName: string)
101117
(readVersion: ReadVersion)
@@ -108,12 +124,15 @@ module ReadRaw =
108124
|> Async.awaitTaskWithInnerException
109125
}
110126

111-
let allForwards' (store: SqlStreamStore.IStreamStore)
112-
(startPositionInclusive: StartPosition)
113-
(msgCount: int)
114-
(prefetchJson: bool)
115-
(cancellationToken: CancellationToken)
116-
: Async<ReadAllPage> =
127+
/// Read forwards from the all stream, prefetching the messages' jsonData.
128+
/// Needs a cancellation token.
129+
/// Can throw exceptions.
130+
let allForwardsPrefetchWithCancellation (store: SqlStreamStore.IStreamStore)
131+
(startPositionInclusive: StartPosition)
132+
(msgCount: int)
133+
(prefetchJson: bool)
134+
(cancellationToken: CancellationToken)
135+
: Async<ReadAllPage> =
117136
async {
118137
return! store.ReadAllForwards
119138
(fromStartPositionInclusiveForwards startPositionInclusive,
@@ -123,51 +142,46 @@ module ReadRaw =
123142
|> Async.awaitTaskWithInnerException
124143
}
125144

126-
let allBackwards' (store: SqlStreamStore.IStreamStore)
127-
(startPositionInclusive: StartPosition)
128-
(msgCount: int)
129-
(prefetchJson: bool)
130-
(cancellationToken: CancellationToken)
131-
: Async<ReadAllPage> =
145+
/// Read forwards from the all stream, prefetching the messages' jsonData.
146+
/// Needs a cancellation token.
147+
/// Can throw exceptions.
148+
let allBackwardsPrefetchWithCancellation (store: SqlStreamStore.IStreamStore)
149+
(startPositionInclusive: StartPosition)
150+
(msgCount: int)
151+
(cancellationToken: CancellationToken)
152+
: Async<ReadAllPage> =
132153
async {
133154
return! store.ReadAllBackwards
134-
(fromStartPositionInclusiveBackwards startPositionInclusive,
135-
msgCount,
136-
prefetchJson,
137-
cancellationToken)
155+
(fromStartPositionInclusiveBackwards startPositionInclusive, msgCount, true, cancellationToken)
138156
|> Async.awaitTaskWithInnerException
139157
}
140158

141-
let streamForwards' (store: SqlStreamStore.IStreamStore)
142-
(streamName: string)
143-
(readVersion: ReadVersion)
144-
(msgCount: int)
145-
(prefetchJson: bool)
146-
(cancellationToken: CancellationToken)
147-
: Async<ReadStreamPage> =
159+
/// Read forwards from a specific stream, prefetching the messages' jsonData.
160+
/// Needs a cancellation token.
161+
/// Can throw exceptions.
162+
let streamForwardsPrefetchWithCancellation (store: SqlStreamStore.IStreamStore)
163+
(streamName: string)
164+
(readVersion: ReadVersion)
165+
(msgCount: int)
166+
(cancellationToken: CancellationToken)
167+
: Async<ReadStreamPage> =
148168
async {
149169
return! store.ReadStreamForwards
150-
(StreamId(streamName),
151-
fromReadVersionForwards readVersion,
152-
msgCount,
153-
prefetchJson,
154-
cancellationToken)
170+
(StreamId(streamName), fromReadVersionForwards readVersion, msgCount, true, cancellationToken)
155171
|> Async.awaitTaskWithInnerException
156172
}
157173

158-
let streamBackwards' (store: SqlStreamStore.IStreamStore)
159-
(streamName: string)
160-
(readVersion: ReadVersion)
161-
(msgCount: int)
162-
(prefetchJson: bool)
163-
(cancellationToken: CancellationToken)
164-
: Async<ReadStreamPage> =
174+
/// Read backwards from a specific stream, prefetching the messages' jsonData.
175+
/// Needs a cancellation token.
176+
/// Can throw exceptions.
177+
let streamBackwardsPrefetchWithCancellation (store: SqlStreamStore.IStreamStore)
178+
(streamName: string)
179+
(readVersion: ReadVersion)
180+
(msgCount: int)
181+
(cancellationToken: CancellationToken)
182+
: Async<ReadStreamPage> =
165183
async {
166184
return! store.ReadStreamBackwards
167-
(StreamId(streamName),
168-
fromReadVersionBackwards readVersion,
169-
msgCount,
170-
prefetchJson,
171-
cancellationToken)
185+
(StreamId(streamName), fromReadVersionBackwards readVersion, msgCount, true, cancellationToken)
172186
|> Async.awaitTaskWithInnerException
173187
}

0 commit comments

Comments
 (0)