Skip to content

Commit 22cfdd4

Browse files
committed
Fix CosmosStoreContext ctor ambiguity
1 parent 8f780a5 commit 22cfdd4

File tree

7 files changed

+93
-104
lines changed

7 files changed

+93
-104
lines changed

README.md

+78-77
Large diffs are not rendered by default.

samples/Infrastructure/Storage.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module Cosmos =
114114
CosmosStoreConnection(client, databaseId, containerId, client2 = client2, databaseId2 = db2, containerId2 = cont2)
115115
log.Information("CosmosStore Max Events in Tip: {maxTipEvents}e {maxTipJsonLength}b Items in Query: {queryMaxItems}",
116116
a.TipMaxEvents, a.TipMaxJsonLength, a.QueryMaxItems)
117-
let ctx = CosmosStoreContext(conn, queryMaxItems = a.QueryMaxItems, tipMaxEvents = a.TipMaxEvents, tipMaxJsonLength = a.TipMaxJsonLength)
117+
let ctx = CosmosStoreContext.Create(conn, defaultMaxItems = a.QueryMaxItems, tipMaxEvents = a.TipMaxEvents, tipMaxJsonLength = a.TipMaxJsonLength)
118118
let cacheStrategy = match cache with Some c -> CachingStrategy.SlidingWindow (c, TimeSpan.FromMinutes 20.) | None -> CachingStrategy.NoCaching
119119
StorageConfig.Cosmos (ctx, cacheStrategy, unfolds)
120120

samples/Tutorial/AsAt.fsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#r "FSharp.Control.AsyncSeq.dll"
3030
#r "System.Net.Http"
3131
#r "Serilog.Sinks.Seq.dll"
32-
#r "Eventstore.ClientAPI.dll"
32+
#r "EventStore.ClientAPI.dll"
3333
#r "Equinox.EventStore.dll"
3434
#r "Microsoft.Azure.Cosmos.Direct.dll"
3535
#r "Microsoft.Azure.Cosmos.Client.dll"

samples/Tutorial/FulfilmentCenter.fsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ service.Read(fc) |> Async.RunSynchronously
144144

145145
Log.dumpMetrics ()
146146

147-
/// Manages ingestion of summary events tagged with the version emitted from FulmentCenter.Service.QueryWithVersion
147+
/// Manages ingestion of summary events tagged with the version emitted from FulfilmentCenter.Service.QueryWithVersion
148148
module FulfilmentCenterSummary =
149149

150150
let streamName id = FsCodec.StreamName.create "FulfilmentCenterSummary" id

src/Equinox.Core/Infrastructure.fs

-12
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,3 @@ type Async with
6767
else
6868
sc ())
6969
|> ignore)
70-
71-
[<RequireQualifiedAccess>]
72-
module Regex =
73-
open System.Text.RegularExpressions
74-
75-
let DefaultTimeout = TimeSpan.FromMilliseconds 250.
76-
let private mkRegex p = Regex(p, RegexOptions.None, DefaultTimeout)
77-
78-
/// Active pattern for branching on successful regex matches
79-
let (|Match|_|) (pattern : string) (input : string) =
80-
let m = (mkRegex pattern).Match input
81-
if m.Success then Some m else None

src/Equinox.CosmosStore/CosmosStore.fs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1223,17 +1223,17 @@ type CosmosStoreConnection
12231223

12241224
/// Defines a set of related access policies for a given CosmosDB, together with a Containers map defining mappings from (category,id) to (databaseId,containerId,streamName)
12251225
type CosmosStoreContext(connection : CosmosStoreConnection, ?queryOptions, ?tipOptions) =
1226-
new(connection : CosmosStoreConnection, ?defaultMaxItems, ?getDefaultMaxItems, ?maxRequests, ?tipOptions) =
1226+
static member Create
1227+
( connection : CosmosStoreConnection,
1228+
?defaultMaxItems, ?getDefaultMaxItems, ?maxRequests,
1229+
/// Maximum number of events permitted in Tip. When this is exceeded, events are moved out to a standalone Batch. Default: 0
1230+
/// NOTE <c>Equinox.Cosmos</c> versions <= 3.0.0 cannot read events in Tip, hence using a non-zero value will not be interoperable.
1231+
?tipMaxEvents,
1232+
/// Maximum serialized size (length of JSON.stringify representation) permitted in Tip before they get moved out to a standalone Batch. Default: 30_000.
1233+
?tipMaxJsonLength) =
12271234
let queryOptions = QueryOptions(?defaultMaxItems = defaultMaxItems, ?getDefaultMaxItems = getDefaultMaxItems, ?maxRequests = maxRequests)
1228-
CosmosStoreContext(connection, queryOptions, ?tipOptions = tipOptions)
1229-
new(connection : CosmosStoreConnection, ?queryMaxItems,
1230-
/// Maximum number of events permitted in Tip. When this is exceeded, events are moved out to a standalone Batch. Default: 0
1231-
/// NOTE <c>Equinox.Cosmos</c> versions <= 3.0.0 cannot read events in Tip, hence using a non-zero value will not be interoperable.
1232-
?tipMaxEvents,
1233-
/// Maximum serialized size (length of JSON.stringify representation) permitted in Tip before they get moved out to a standalone Batch. Default: 30_000.
1234-
?tipMaxJsonLength) =
12351235
let tipOptions = TipOptions(?maxEvents = tipMaxEvents, ?maxJsonLength = tipMaxJsonLength)
1236-
CosmosStoreContext(connection, tipOptions = tipOptions, ?defaultMaxItems = queryMaxItems)
1236+
CosmosStoreContext(connection, queryOptions, tipOptions)
12371237
member val QueryOptions = queryOptions |> Option.defaultWith QueryOptions
12381238
member val TipOptions = tipOptions |> Option.defaultWith TipOptions
12391239
member internal __.ResolveContainerClientAndStreamIdAndInit(categoryName, streamId) =

tests/Equinox.CosmosStore.Integration/CosmosFixtures.fs

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ let connectWithFallback log =
4545

4646
let createPrimaryContextEx log queryMaxItems tipMaxEvents =
4747
let conn = connectPrimary log
48-
CosmosStoreContext(conn, queryMaxItems = queryMaxItems, tipMaxEvents = tipMaxEvents)
48+
CosmosStoreContext.Create(conn, defaultMaxItems = queryMaxItems, tipMaxEvents = tipMaxEvents)
4949

5050
let defaultTipMaxEvents = 10
5151

@@ -54,11 +54,11 @@ let createPrimaryContext log queryMaxItems =
5454

5555
let createSecondaryContext log queryMaxItems =
5656
let conn = connectSecondary log
57-
CosmosStoreContext(conn, queryMaxItems = queryMaxItems, tipMaxEvents = defaultTipMaxEvents)
57+
CosmosStoreContext.Create(conn, defaultMaxItems = queryMaxItems, tipMaxEvents = defaultTipMaxEvents)
5858

5959
let createFallbackContext log queryMaxItems =
6060
let conn = connectWithFallback log
61-
CosmosStoreContext(conn, queryMaxItems = queryMaxItems, tipMaxEvents = defaultTipMaxEvents)
61+
CosmosStoreContext.Create(conn, defaultMaxItems = queryMaxItems, tipMaxEvents = defaultTipMaxEvents)
6262

6363
let defaultQueryMaxItems = 10
6464

0 commit comments

Comments
 (0)