Skip to content

Commit 405eda6

Browse files
committed
chore(Deps): Target DynamoStore 4.2, AWSSDK 4
1 parent 908e84f commit 405eda6

File tree

10 files changed

+87
-87
lines changed

10 files changed

+87
-87
lines changed

src/Propulsion.DynamoStore.Indexer/Handler.fs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
module Propulsion.DynamoStore.Indexer.Handler
22

33
open Amazon.DynamoDBv2
4+
open Amazon.Lambda.DynamoDBEvents
45
open Propulsion.DynamoStore
56

6-
let private parse (log: Serilog.ILogger) (dynamoEvent: Amazon.Lambda.DynamoDBEvents.DynamoDBEvent): AppendsEpoch.Events.StreamSpan[] =
7+
let private parse (log: Serilog.ILogger) (dynamoEvent: DynamoDBEvent): AppendsEpoch.Events.StreamSpan[] =
78
let spans, summary = ResizeArray(), System.Text.StringBuilder()
89
let mutable indexStream, systemStreams, noEvents = 0, 0, 0
910
try for record in dynamoEvent.Records do
1011
match record.Dynamodb.StreamViewType with
11-
| x when x = StreamViewType.NEW_IMAGE || x = StreamViewType.NEW_AND_OLD_IMAGES -> ()
12+
| x when x = string StreamViewType.NEW_IMAGE || x = string StreamViewType.NEW_AND_OLD_IMAGES -> ()
1213
| x -> invalidOp $"Unexpected StreamViewType {x}"
1314

14-
summary.Append(record.EventName.Value[0]) |> ignore
15+
summary.Append(record.EventName) |> ignore
1516

1617
let updated = record.Dynamodb.NewImage
1718
match record.EventName with
18-
| ot when ot = OperationType.REMOVE -> ()
19-
| ot when ot = OperationType.INSERT || ot = OperationType.MODIFY ->
19+
| ot when ot = "REMOVE" -> ()
20+
| ot when ot = "INSERT" || ot = "MODIFY" ->
2021
let p = record.Dynamodb.Keys["p"].S
2122
let sn, n = IndexStreamId.ofP p, int64 updated["n"].N
2223
if p.StartsWith AppendsEpoch.Stream.Category || p.StartsWith AppendsIndex.Stream.Category then indexStream <- indexStream + 1
@@ -40,7 +41,7 @@ let private parse (log: Serilog.ILogger) (dynamoEvent: Amazon.Lambda.DynamoDBEve
4041
| [| et |] -> ":" + et
4142
| xs -> $":%s{xs[0]}+%d{xs.Length - 1}"
4243
summary.Append(p).Append(et).Append(if i = 0 then " " else $"@%d{i} ") |> ignore
43-
| et -> invalidOp $"Unknown OperationType %s{et.Value}"
44+
| et -> invalidOp $"Unknown OperationType %s{et}"
4445
let spans = spans.ToArray()
4546
log.Information("Index {indexCount} System {systemCount} NoEvents {noEventCount} Spans {spanCount} {summary}",
4647
indexStream, systemStreams, noEvents, spans.Length, summary)

src/Propulsion.DynamoStore.Indexer/Propulsion.DynamoStore.Indexer.fsproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929

3030
<ItemGroup>
3131
<PackageReference Include="MinVer" Version="5.0.0" PrivateAssets="All" />
32-
33-
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
34-
<PackageReference Include="Amazon.Lambda.DynamoDBEvents" Version="2.1.1" />
35-
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
32+
33+
<PackageReference Include="Amazon.Lambda.Core" Version="2.8.1" />
34+
<PackageReference Include="Amazon.Lambda.DynamoDBEvents" Version="3.1.2" />
35+
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.5" />
3636
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
3737
<ProjectReference Condition=" '$(PinnedDynamoStoreRootPackage)' == '' " Include="..\Propulsion.DynamoStore\Propulsion.DynamoStore.fsproj" />
3838
<PackageReference Condition=" '$(PinnedDynamoStoreRootPackage)' != '' " Include="Propulsion.DynamoStore" Version="$(PinnedDynamoStoreRootPackage)" />

src/Propulsion.DynamoStore.Notifier/Handler.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Propulsion.DynamoStore.Notifier.Handler
22

3-
open Amazon.DynamoDBv2
3+
open Amazon.DynamoDBStreams
44
open Amazon.Lambda.DynamoDBEvents
55
open Amazon.SimpleNotificationService
66
open Amazon.SimpleNotificationService.Model
@@ -20,16 +20,16 @@ let private parse (log: Serilog.ILogger) (dynamoEvent: DynamoDBEvent): KeyValueP
2020
let mutable indexStream, otherStream, noEvents = 0, 0, 0
2121
try for record in dynamoEvent.Records do
2222
match record.Dynamodb.StreamViewType with
23-
| x when x = StreamViewType.NEW_IMAGE || x = StreamViewType.NEW_AND_OLD_IMAGES -> ()
23+
| x when x = string StreamViewType.NEW_IMAGE || x = string StreamViewType.NEW_AND_OLD_IMAGES -> ()
2424
| x -> invalidOp $"Unexpected StreamViewType {x}"
2525

2626
if summary.Length <> 0 then summary.Append ' ' |> ignore
27-
summary.Append(record.EventName.Value[0]) |> ignore
27+
summary.Append(record.EventName) |> ignore
2828

2929
let updated = record.Dynamodb.NewImage
3030
match record.EventName with
31-
| ot when ot = OperationType.REMOVE -> ()
32-
| ot when ot = OperationType.INSERT || ot = OperationType.MODIFY ->
31+
| ot when ot = "REMOVE" -> ()
32+
| ot when ot = "INSERT" || ot = "MODIFY" ->
3333
let p = record.Dynamodb.Keys["p"].S
3434
match FsCodec.StreamName.parse p with
3535
| AppendsEpoch.Stream.For (partitionId, epochId) ->
@@ -50,7 +50,7 @@ let private parse (log: Serilog.ILogger) (dynamoEvent: DynamoDBEvent): KeyValueP
5050
| _ ->
5151
if p.StartsWith AppendsIndex.Stream.Category then indexStream <- indexStream + 1
5252
else otherStream <- otherStream + 1
53-
| et -> invalidOp $"Unknown OperationType %s{et.Value}"
53+
| et -> invalidOp $"Unknown OperationType %s{et}"
5454
log.Information("Index {indexCount} Other {otherCount} NoEvents {noEventCount} Tails {tails} {summary:l}",
5555
indexStream, otherStream, noEvents, Seq.map ValueTuple.ofKvp tails, summary)
5656
Array.ofSeq tails

src/Propulsion.DynamoStore.Notifier/Propulsion.DynamoStore.Notifier.fsproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@
3737
<ItemGroup>
3838
<PackageReference Include="MinVer" Version="5.0.0" PrivateAssets="All" />
3939

40-
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
41-
<PackageReference Include="Amazon.Lambda.DynamoDBEvents" Version="2.1.1" />
42-
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
43-
<PackageReference Include="AWSSDK.SimpleNotificationService" Version="3.7.4.10" />
40+
<PackageReference Include="Amazon.Lambda.Core" Version="2.8.1 " />
41+
<PackageReference Include="Amazon.Lambda.DynamoDBEvents" Version="3.1.2" />
42+
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.5" />
43+
<PackageReference Include="AWSSDK.DynamoDBStreams" Version="4.0.4.14" />
44+
<PackageReference Include="AWSSDK.SimpleNotificationService" Version="4.0.2.16" />
4445
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
4546
<ProjectReference Condition=" '$(PinnedBaselineRootPackage)' == '' " Include="..\Propulsion\Propulsion.fsproj" />
4647
<PackageReference Condition=" '$(PinnedBaselineRootPackage)' != '' " Include="Propulsion" Version="$(PinnedBaselineRootPackage)" />

src/Propulsion.DynamoStore/Propulsion.DynamoStore.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<ItemGroup>
2727
<PackageReference Include="MinVer" Version="5.0.0" PrivateAssets="All" />
2828

29-
<PackageReference Include="Equinox.DynamoStore" Version="4.0.0" />
29+
<PackageReference Include="Equinox.DynamoStore" Version="4.2.0-rc.1" />
3030
<PackageReference Include="FsCodec.SystemTextJson" Version="3.1.0" />
3131
</ItemGroup>
3232

src/Propulsion/Pipeline.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Pipeline(task: Task<unit>, triggerStop) =
3434
use _ = ct.Register(Action x.Stop)
3535
return! x.Await() }
3636

37-
type SourcePipeline<'M, 'P>(task, flush: unit -> Task<'P>, triggerStop, monitor: Lazy<'M>) =
37+
type SourcePipeline<'M, 'P>(task, flush: unit -> Task<'P>, triggerStop, monitor: Lazy<'M>) =
3838
inherit Pipeline(task, triggerStop)
3939

4040
member _.Monitor = monitor.Value

src/Propulsion/Propulsion.fsproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<TargetFramework>net6.0</TargetFramework>
7-
<!-- NOTE FSharp.Core dep is implies by what `FSharp.Control.TaskSeq` dictates; see below -->
7+
<!-- We want to depend on as old a version as possible. That would be 6.0.1, but we need v8 to be able to do RequireQualifiedAccess on a Struct with a V9+ compiler -->
88
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
99
<PackageValidationBaselineVersion>3.0.0</PackageValidationBaselineVersion>
1010
</PropertyGroup>
@@ -31,9 +31,9 @@
3131

3232
<ItemGroup>
3333
<PackageReference Include="MinVer" Version="5.0.0" PrivateAssets="All" />
34-
34+
<!-- Min FSharp.Core version that allows RequireQualifiedAccess on structs -->
35+
<PackageReference Include="FSharp.Core" Version="8.0.403" />
3536
<PackageReference Include="FsCodec" Version="3.1.0" />
36-
<!-- NOTE this transitively implies a min FSharp.Core 6.0.1 dependency (was 6.0.0 before) -->
3737
<PackageReference Include="FSharp.Control.TaskSeq" Version="0.4.0" />
3838
<PackageReference Include="MathNet.Numerics" Version="4.15.0" />
3939
<PackageReference Include="Serilog" Version="2.7.1" />

tests/Propulsion.Tests/Propulsion.Tests.fsproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
<ItemGroup>
2828
<PackageReference Include="FsCheck.Xunit" Version="3.0.0-rc3" />
2929
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
30-
<!-- Pin requirement for at least 6.0.6 in one of the tests by requesting same as Propulsion.DynamoStore will require-->
31-
<PackageReference Include="FSharp.Core" Version="6.0.7" ExcludeAssets="contentfiles" />
3230
<PackageReference Include="unquote" Version="6.1.0" />
3331
<PackageReference Include="xunit" Version="2.7.0" />
3432
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">

tools/Propulsion.Tool/Infrastructure.fs

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -61,60 +61,60 @@ type Logging() =
6161
let logEventIsMetric x = Serilog.Filters.Matching.WithProperty(Metrics.PropertyTag).Invoke x
6262
configuration.Sinks(configureMetricsSinks, Sinks.console verboseConsole, ?isMetric = if verboseStore then None else Some logEventIsMetric)
6363

64-
module CosmosStoreConnector =
65-
66-
let private get (role: string) (client: Microsoft.Azure.Cosmos.CosmosClient) databaseId containerId =
67-
Log.Information("CosmosDB {role} {database}/{container}", role, databaseId, containerId)
68-
client.GetDatabase(databaseId).GetContainer(containerId)
69-
let getSource = get "Source"
70-
let getLeases = get "Leases"
71-
let createMonitoredAndLeases client databaseId containerId auxContainerId =
72-
getSource client databaseId containerId, getLeases client databaseId auxContainerId
73-
74-
type Equinox.CosmosStore.CosmosStoreContext with
75-
76-
member x.LogConfiguration(role, databaseId: string, containerId: string) =
77-
Log.Information("CosmosStore {role:l} {database}/{container} Tip maxEvents {maxEvents} maxSize {maxJsonLen} Query maxItems {queryMaxItems}",
78-
role, databaseId, containerId, x.TipOptions.MaxEvents, x.TipOptions.MaxJsonLength, x.QueryOptions.MaxItems)
79-
80-
type Equinox.CosmosStore.CosmosStoreClient with
81-
82-
member x.CreateContext(role: string, databaseId, containerId, tipMaxEvents, ?queryMaxItems, ?tipMaxJsonLength, ?skipLog) =
83-
let c = Equinox.CosmosStore.CosmosStoreContext(x, databaseId, containerId, tipMaxEvents, ?queryMaxItems = queryMaxItems, ?tipMaxJsonLength = tipMaxJsonLength)
84-
if skipLog = Some true then () else c.LogConfiguration(role, databaseId, containerId)
85-
c
86-
87-
type Equinox.CosmosStore.CosmosStoreConnector with
88-
89-
member private x.LogConfiguration(role, databaseId: string, containers: string[]) =
90-
let o = x.Options
91-
let timeout, retries429, timeout429 = o.RequestTimeout, o.MaxRetryAttemptsOnRateLimitedRequests, o.MaxRetryWaitTimeOnRateLimitedRequests
92-
Log.Information("CosmosDB {role} {mode} {endpointUri} {database}/{containers} timeout {timeout}s Retries {retries}<{maxRetryWaitTime}s",
93-
role, o.ConnectionMode, x.Endpoint, databaseId, containers, timeout.TotalSeconds, retries429, let t = timeout429.Value in t.TotalSeconds)
94-
member private x.CreateAndInitialize(role, databaseId, containers) =
95-
x.LogConfiguration(role, databaseId, containers)
96-
x.CreateAndInitialize(databaseId, containers)
97-
member private x.Connect(role, databaseId, containers) =
98-
x.LogConfiguration(role, databaseId, containers)
99-
x.Connect(databaseId, containers)
100-
101-
// NOTE uses CreateUninitialized as the Database/Container may not actually exist yet
102-
member x.CreateLeasesContainer(databaseId, auxContainerId) =
103-
x.LogConfiguration("Feed", databaseId, [| auxContainerId |])
104-
let client = x.CreateUninitialized()
105-
CosmosStoreConnector.getLeases client databaseId auxContainerId
106-
107-
member x.ConnectFeed(databaseId, containerId, auxContainerId) = async {
108-
let! cosmosClient = x.CreateAndInitialize("Feed", databaseId, [| containerId; auxContainerId |])
109-
return CosmosStoreConnector.createMonitoredAndLeases cosmosClient databaseId containerId auxContainerId }
110-
111-
/// CosmosSync: When using a ReadOnly connection string, the leases need to be maintained alongside the target
112-
member x.ConnectFeedReadOnly(databaseId, containerId, auxClient, auxDatabaseId, auxContainerId) = async {
113-
let! client = x.CreateAndInitialize("Main", databaseId, [| containerId |])
114-
let source = CosmosStoreConnector.getSource client databaseId containerId
115-
let leases = CosmosStoreConnector.getLeases auxClient auxDatabaseId auxContainerId
116-
return source, leases }
117-
118-
member x.ConnectContext(role, databaseId, containerId: string, maxEvents) = async {
119-
let! client = x.Connect(role, databaseId, [| containerId |])
120-
return client.CreateContext(role, databaseId, containerId, tipMaxEvents = maxEvents) }
64+
module CosmosStoreConnector =
65+
66+
let private get (role: string) (client: Microsoft.Azure.Cosmos.CosmosClient) databaseId containerId =
67+
Log.Information("CosmosDB {role} {database}/{container}", role, databaseId, containerId)
68+
client.GetDatabase(databaseId).GetContainer(containerId)
69+
let getSource = get "Source"
70+
let getLeases = get "Leases"
71+
let createMonitoredAndLeases client databaseId containerId auxContainerId =
72+
getSource client databaseId containerId, getLeases client databaseId auxContainerId
73+
74+
type Equinox.CosmosStore.CosmosStoreContext with
75+
76+
member x.LogConfiguration(role, databaseId: string, containerId: string) =
77+
Log.Information("CosmosStore {role:l} {database}/{container} Tip maxEvents {maxEvents} maxSize {maxJsonLen} Query maxItems {queryMaxItems}",
78+
role, databaseId, containerId, x.TipOptions.MaxEvents, x.TipOptions.MaxJsonLength, x.QueryOptions.MaxItems)
79+
80+
type Equinox.CosmosStore.CosmosStoreClient with
81+
82+
member x.CreateContext(role: string, databaseId, containerId, tipMaxEvents, ?queryMaxItems, ?tipMaxJsonLength, ?skipLog) =
83+
let c = Equinox.CosmosStore.CosmosStoreContext(x, databaseId, containerId, tipMaxEvents, ?queryMaxItems = queryMaxItems, ?tipMaxJsonLength = tipMaxJsonLength)
84+
if skipLog = Some true then () else c.LogConfiguration(role, databaseId, containerId)
85+
c
86+
87+
type Equinox.CosmosStore.CosmosStoreConnector with
88+
89+
member private x.LogConfiguration(role, databaseId: string, containers: string[]) =
90+
let o = x.Options
91+
let timeout, retries429, timeout429 = o.RequestTimeout, o.MaxRetryAttemptsOnRateLimitedRequests, o.MaxRetryWaitTimeOnRateLimitedRequests
92+
Log.Information("CosmosDB {role} {mode} {endpointUri} {database}/{containers} timeout {timeout}s Retries {retries}<{maxRetryWaitTime}s",
93+
role, o.ConnectionMode, x.Endpoint, databaseId, containers, timeout.TotalSeconds, retries429, let t = timeout429.Value in t.TotalSeconds)
94+
member private x.CreateAndInitialize(role, databaseId, containers) =
95+
x.LogConfiguration(role, databaseId, containers)
96+
x.CreateAndInitialize(databaseId, containers)
97+
member private x.Connect(role, databaseId, containers) =
98+
x.LogConfiguration(role, databaseId, containers)
99+
x.Connect(databaseId, containers)
100+
101+
// NOTE uses CreateUninitialized as the Database/Container may not actually exist yet
102+
member x.CreateLeasesContainer(databaseId, auxContainerId) =
103+
x.LogConfiguration("Feed", databaseId, [| auxContainerId |])
104+
let client = x.CreateUninitialized()
105+
CosmosStoreConnector.getLeases client databaseId auxContainerId
106+
107+
member x.ConnectFeed(databaseId, containerId, auxContainerId) = async {
108+
let! cosmosClient = x.CreateAndInitialize("Feed", databaseId, [| containerId; auxContainerId |])
109+
return CosmosStoreConnector.createMonitoredAndLeases cosmosClient databaseId containerId auxContainerId }
110+
111+
/// CosmosSync: When using a ReadOnly connection string, the leases need to be maintained alongside the target
112+
member x.ConnectFeedReadOnly(databaseId, containerId, auxClient, auxDatabaseId, auxContainerId) = async {
113+
let! client = x.CreateAndInitialize("Main", databaseId, [| containerId |])
114+
let source = CosmosStoreConnector.getSource client databaseId containerId
115+
let leases = CosmosStoreConnector.getLeases auxClient auxDatabaseId auxContainerId
116+
return source, leases }
117+
118+
member x.ConnectContext(role, databaseId, containerId: string, maxEvents) = async {
119+
let! client = x.Connect(role, databaseId, [| containerId |])
120+
return client.CreateContext(role, databaseId, containerId, tipMaxEvents = maxEvents) }

tools/Propulsion.Tool/Propulsion.Tool.fsproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535

3636
<PackageReference Include="Argu" Version="6.2.2" />
3737
<!-- Required or there'll be an exception at runtime re missing support DLLs when using RBAC -->
38-
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.1.177" />
38+
<PackageReference Include="AWSSDK.SecurityToken" Version="4.0.5.9" />
3939
<!-- Required for AWS SSO resolution -->
40-
<PackageReference Include="AWSSDK.SSO" Version="3.7.100.69" />
41-
<PackageReference Include="AWSSDK.SSOOIDC" Version="3.7.100.69" />
40+
<PackageReference Include="AWSSDK.SSO" Version="4.0.2.13" />
41+
<PackageReference Include="AWSSDK.SSOOIDC" Version="4.0.3.14" />
4242
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
4343
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
4444
</ItemGroup>

0 commit comments

Comments
 (0)