@@ -42,14 +42,14 @@ module Cosmos =
4242 | LagFreqM _ -> " specify frequency (minutes) to dump lag stats. Default: 1"
4343
4444 type Arguments ( c : Args.Configuration , p : ParseResults < Parameters >) =
45- let discovery = p.TryGetResult Connection |> Option.defaultWith ( fun () -> c.CosmosConnection) |> Equinox.CosmosStore.Discovery.ConnectionString
45+ let discovery = p.GetResult ( Connection, fun () -> c.CosmosConnection) |> Equinox.CosmosStore.Discovery.ConnectionString
4646 let mode = p.TryGetResult ConnectionMode
4747 let timeout = p.GetResult( Timeout, 5. ) |> TimeSpan.FromSeconds
4848 let retries = p.GetResult( Retries, 9 )
4949 let maxRetryWaitTime = p.GetResult( RetriesWaitTime, 30. ) |> TimeSpan.FromSeconds
5050 let connector = Equinox.CosmosStore.CosmosStoreConnector( discovery, timeout, retries, maxRetryWaitTime, ?mode = mode)
51- let database = p.TryGetResult Database |> Option.defaultWith ( fun () -> c.CosmosDatabase)
52- let containerId = p.TryGetResult Container |> Option.defaultWith ( fun () -> c.CosmosContainer)
51+ let database = p.GetResult ( Database, fun () -> c.CosmosDatabase)
52+ let containerId = p.GetResult ( Container, fun () -> c.CosmosContainer)
5353 let leaseContainerId = p.GetResult( LeaseContainer, containerId + " -aux" )
5454 let fromTail = p.Contains FromTail
5555 let maxItems = p.TryGetResult MaxItems
@@ -99,9 +99,9 @@ module Dynamo =
9999 | Some systemName ->
100100 Choice1Of2 systemName
101101 | None ->
102- let serviceUrl = p.TryGetResult ServiceUrl |> Option.defaultWith ( fun () -> c.DynamoServiceUrl)
103- let accessKey = p.TryGetResult AccessKey |> Option.defaultWith ( fun () -> c.DynamoAccessKey)
104- let secretKey = p.TryGetResult SecretKey |> Option.defaultWith ( fun () -> c.DynamoSecretKey)
102+ let serviceUrl = p.GetResult ( ServiceUrl, fun () -> c.DynamoServiceUrl)
103+ let accessKey = p.GetResult ( AccessKey, fun () -> c.DynamoAccessKey)
104+ let secretKey = p.GetResult ( SecretKey, fun () -> c.DynamoSecretKey)
105105 Choice2Of2 ( serviceUrl, accessKey, secretKey)
106106 let connector = let timeout = p.GetResult( RetriesTimeoutS, 60. ) |> TimeSpan.FromSeconds
107107 let retries = p.GetResult( Retries, 9 )
@@ -110,9 +110,9 @@ module Dynamo =
110110 Equinox.DynamoStore.DynamoStoreConnector( systemName, timeout, retries)
111111 | Choice2Of2 ( serviceUrl, accessKey, secretKey) ->
112112 Equinox.DynamoStore.DynamoStoreConnector( serviceUrl, accessKey, secretKey, timeout, retries)
113- let table = p.TryGetResult Table |> Option.defaultWith ( fun () -> c.DynamoTable)
113+ let table = p.GetResult ( Table, fun () -> c.DynamoTable)
114114 let indexSuffix = p.GetResult( IndexSuffix, " -index" )
115- let indexTable = p.TryGetResult IndexTable |> Option.orElseWith ( fun () -> c.DynamoIndexTable) |> Option.defaultWith ( fun () -> table + indexSuffix)
115+ let indexTable = p.GetResult ( IndexTable, fun () -> defaultArg c.DynamoIndexTable ( table + indexSuffix) )
116116 let fromTail = p.Contains FromTail
117117 let tailSleepInterval = TimeSpan.FromMilliseconds 500.
118118 let batchSizeCutoff = p.GetResult( MaxItems, 100 )
@@ -142,9 +142,9 @@ module Esdb =
142142 Propulsion.Feed.ReaderCheckpoint.CosmosStore.create Store.Metrics.log ( consumerGroup, checkpointInterval) ( context, cache)
143143 | Store.Config.Dynamo ( context, cache) ->
144144 Propulsion.Feed.ReaderCheckpoint.DynamoStore.create Store.Metrics.log ( consumerGroup, checkpointInterval) ( context, cache)
145- | Store.Config.Memory _ | Store.Config.Esdb _ -> Args.missingArg " Unexpected store type"
145+ | Store.Config.Memory _ | Store.Config.Esdb _ -> failwith " Unexpected store type"
146146
147- type [<NoEquality; NoComparison>] Parameters =
147+ type [<NoEquality; NoComparison; RequireSubcommand >] Parameters =
148148 | [<AltCommandLine " -V" >] Verbose
149149 | [<AltCommandLine " -c" >] Connection of string
150150 | [<AltCommandLine " -p" ; Unique>] Credentials of string
@@ -154,8 +154,8 @@ module Esdb =
154154 | [<AltCommandLine " -b" ; Unique>] MaxItems of int
155155 | [<AltCommandLine " -Z" ; Unique>] FromTail
156156
157- | [<CliPrefix( CliPrefix.None); Unique (* ExactlyOnce is not supported *) ; Last >] Cosmos of ParseResults < Args.Cosmos.Parameters >
158- | [<CliPrefix( CliPrefix.None); Unique (* ExactlyOnce is not supported *) ; Last >] Dynamo of ParseResults < Args.Dynamo.Parameters >
157+ | [<CliPrefix( CliPrefix.None) >] Cosmos of ParseResults < Args.Cosmos.Parameters >
158+ | [<CliPrefix( CliPrefix.None) >] Dynamo of ParseResults < Args.Dynamo.Parameters >
159159 interface IArgParserTemplate with
160160 member p.Usage = p |> function
161161 | Verbose -> " Include low level Store logging."
@@ -174,7 +174,7 @@ module Esdb =
174174 let startFromTail = p.Contains FromTail
175175 let maxItems = p.GetResult( MaxItems, 100 )
176176 let tailSleepInterval = TimeSpan.FromSeconds 0.5
177- let connectionStringLoggable = p.TryGetResult Connection |> Option.defaultWith ( fun () -> c.EventStoreConnection)
177+ let connectionStringLoggable = p.GetResult ( Connection, fun () -> c.EventStoreConnection)
178178 let credentials = p.TryGetResult Credentials |> Option.orElseWith ( fun () -> c.MaybeEventStoreCredentials)
179179 let discovery = match credentials with Some x -> String.Join( " ;" , connectionStringLoggable, x) | None -> connectionStringLoggable
180180 |> Equinox.EventStoreDb.Discovery.ConnectionString
@@ -193,7 +193,7 @@ module Esdb =
193193 match p.GetSubCommand() with
194194 | Cosmos cosmos -> Args.TargetStoreArgs.Cosmos ( Args.Cosmos.Arguments( c, cosmos))
195195 | Dynamo dynamo -> Args.TargetStoreArgs.Dynamo ( Args.Dynamo.Arguments( c, dynamo))
196- | _ -> Args.missingArg " Must specify `cosmos` or `dynamo` target store when source is `esdb`"
196+ | _ -> p.Raise " Must specify `cosmos` or `dynamo` target store when source is `esdb`"
197197
198198 member _.MonitoringParams ( log : ILogger ) =
199199 log.Information( " EventStoreSource MaxItems {maxItems} " , maxItems)
0 commit comments