From d75bd1d0c9fefe2db1d81881901fce1e81685739 Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Fri, 12 Jun 2020 14:15:03 +0100 Subject: [PATCH] Cleanup from Cosmos --- equinox-fc/Domain.Tests/LocationTests.fs | 5 +++-- equinox-fc/Domain/StockProcessManager.fs | 2 +- equinox-fc/Web/Program.fs | 13 ++++++------- equinox-fc/Web/Web.fsproj | 1 - 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/equinox-fc/Domain.Tests/LocationTests.fs b/equinox-fc/Domain.Tests/LocationTests.fs index 2a0c39ec0..4e4a67645 100644 --- a/equinox-fc/Domain.Tests/LocationTests.fs +++ b/equinox-fc/Domain.Tests/LocationTests.fs @@ -5,6 +5,7 @@ open FSharp.UMX open Swensen.Unquote open System +open Fc.Domain open Fc.Domain.Location /// Helpers to match `module Cosmos/EventStore` wrapping inside the impl @@ -28,7 +29,7 @@ module Location = let epochs = Epoch.create (Epoch.resolve store) maxAttempts create (zeroBalance, toBalanceCarriedForward, shouldClose) (series, epochs) -let run (service : Fc.Domain.Location.Service) (IdsAtLeastOne locations, deltas : _[], transactionId) = Async.RunSynchronously <| async { +let run (service : Service) (IdsAtLeastOne locations, deltas : _[], transactionId) = Async.RunSynchronously <| async { let runId = mkId () // Need to make making state in store unique when replaying or shrinking let locations = locations |> Array.map (fun x -> % (sprintf "%O/%O" x runId)) @@ -70,5 +71,5 @@ type EventStore(testOutput) = let epochLen, idsWindow = max 1 epochLen, 5 let zero, cf, sc = Epoch.zeroBalance, Epoch.toBalanceCarriedForward idsWindow, Epoch.shouldClose epochLen - let service = Fc.Domain.Location.EventStore.create (zero, cf, sc) (context, cache, 50) + let service = Location.EventStore.create (zero, cf, sc) (context, cache, 50) run service args diff --git a/equinox-fc/Domain/StockProcessManager.fs b/equinox-fc/Domain/StockProcessManager.fs index 5bab583b4..4722c3c29 100644 --- a/equinox-fc/Domain/StockProcessManager.fs +++ b/equinox-fc/Domain/StockProcessManager.fs @@ -47,7 +47,7 @@ type Service(transactions : StockTransaction.Service, locations : Location.Servi module EventStore = - let create inventoryId (epochLen, idsWindow, maxAttempts) (context, cache) = + let create (context, cache) inventoryId (epochLen, idsWindow, maxAttempts) = let transactions, locations, inventory = let transactions = StockTransaction.EventStore.create (context, cache) let zero, cf, sc = Location.Epoch.zeroBalance, Location.Epoch.toBalanceCarriedForward idsWindow, Location.Epoch.shouldClose epochLen diff --git a/equinox-fc/Web/Program.fs b/equinox-fc/Web/Program.fs index d0da80df9..aa9562926 100644 --- a/equinox-fc/Web/Program.fs +++ b/equinox-fc/Web/Program.fs @@ -146,16 +146,15 @@ type Startup() = .UseEndpoints(fun endpoints -> endpoints.MapControllers() |> ignore) |> ignore - let build (args : Args.Arguments) = let cache = Equinox.Cache(AppName, sizeMb=10) - + let create = + let es = args.Source + let connection = es.Connect(Log.Logger, Log.Logger, AppName, Equinox.EventStore.ConnectionStrategy.ClusterSingle Equinox.EventStore.NodePreference.Master) + let context = Equinox.EventStore.Context(connection, Equinox.EventStore.BatchingPolicy(maxBatchSize=500)) + Fc.Domain.StockProcessManager.EventStore.create (context, cache) let inventoryId = InventoryId.parse "FC000" - - let es = args.Source - let connection = es.Connect(Log.Logger, Log.Logger, AppName, Equinox.EventStore.ConnectionStrategy.ClusterSingle Equinox.EventStore.NodePreference.Master) - let context = Equinox.EventStore.Context(connection, Equinox.EventStore.BatchingPolicy(maxBatchSize=500)) - Fc.Domain.StockProcessManager.EventStore.create inventoryId (1000, 5, 3) (context, cache) + create inventoryId (1000, 5, 3) let run argv args = let processManager = build args diff --git a/equinox-fc/Web/Web.fsproj b/equinox-fc/Web/Web.fsproj index 5ef2d9568..85146417a 100644 --- a/equinox-fc/Web/Web.fsproj +++ b/equinox-fc/Web/Web.fsproj @@ -13,7 +13,6 @@ -