From e73d6f353f40e517e68bfb6fe1574b73211a1fba Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Tue, 10 Mar 2020 13:24:04 +0000 Subject: [PATCH] Stragglers --- equinox-fc/Domain.Tests/LocationTests.fs | 8 ++++---- equinox-fc/Domain/InventoryEpoch.fs | 10 +++++----- equinox-fc/Domain/InventorySeries.fs | 4 ++-- equinox-fc/Domain/InventoryTransaction.fs | 4 ++-- equinox-fc/Domain/LocationEpoch.fs | 8 ++++---- equinox-fc/Domain/LocationSeries.fs | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/equinox-fc/Domain.Tests/LocationTests.fs b/equinox-fc/Domain.Tests/LocationTests.fs index 536505c57..7e2217f7d 100644 --- a/equinox-fc/Domain.Tests/LocationTests.fs +++ b/equinox-fc/Domain.Tests/LocationTests.fs @@ -15,16 +15,16 @@ module Location = module Series = - let resolve store = Resolver(store, Series.Events.codec, Series.Fold.fold, Series.Fold.initial).Resolve + let resolver store = Resolver(store, Series.Events.codec, Series.Fold.fold, Series.Fold.initial).Resolve module Epoch = - let resolve store = Resolver(store, Epoch.Events.codec, Epoch.Fold.fold, Epoch.Fold.initial).Resolve + let resolver store = Resolver(store, Epoch.Events.codec, Epoch.Fold.fold, Epoch.Fold.initial).Resolve let createService (zeroBalance, shouldClose) store = let maxAttempts = Int32.MaxValue - let series = Series.create (Series.resolve store) maxAttempts - let epochs = Epoch.create (Epoch.resolve store) maxAttempts + let series = Series.create (Series.resolver store) maxAttempts + let epochs = Epoch.create (Epoch.resolver store) maxAttempts create (zeroBalance, shouldClose) (series, epochs) let run (service : Location.Service) (IdsAtLeastOne locations, deltas : _[], transactionId) = Async.RunSynchronously <| async { diff --git a/equinox-fc/Domain/InventoryEpoch.fs b/equinox-fc/Domain/InventoryEpoch.fs index 74d5b6d50..9942b5f2e 100644 --- a/equinox-fc/Domain/InventoryEpoch.fs +++ b/equinox-fc/Domain/InventoryEpoch.fs @@ -82,15 +82,15 @@ type Service internal (resolve : InventoryId * InventoryEpochId -> Equinox.Strea stream.Transact(decideSync capacity events) let create resolver = - let resolve locationId = - let stream = resolver (streamName locationId) + let resolve ids = + let stream = resolver (streamName ids) Equinox.Stream(Serilog.Log.ForContext(), stream, maxAttempts = 2) - Service (resolve) + Service(resolve) module Cosmos = let accessStrategy = Equinox.Cosmos.AccessStrategy.Snapshot (Fold.isOrigin, Fold.snapshot) - let resolve (context, cache) = + let resolver (context, cache) = let cacheStrategy = Equinox.Cosmos.CachingStrategy.SlidingWindow (cache, System.TimeSpan.FromMinutes 20.) Equinox.Cosmos.Resolver(context, Events.codec, Fold.fold, Fold.initial, cacheStrategy, accessStrategy).Resolve - let create (context, cache) = create (resolve (context, cache)) + let create (context, cache) = create (resolver (context, cache)) diff --git a/equinox-fc/Domain/InventorySeries.fs b/equinox-fc/Domain/InventorySeries.fs index a93f5a67d..011f24fee 100644 --- a/equinox-fc/Domain/InventorySeries.fs +++ b/equinox-fc/Domain/InventorySeries.fs @@ -49,7 +49,7 @@ let create resolver = module Cosmos = let accessStrategy = Equinox.Cosmos.AccessStrategy.LatestKnownEvent - let resolve (context, cache) = + let resolver (context, cache) = let cacheStrategy = Equinox.Cosmos.CachingStrategy.SlidingWindow (cache, System.TimeSpan.FromMinutes 20.) // For this stream, we uniformly use stale reads as: // a) we don't require any information from competing writers @@ -57,4 +57,4 @@ module Cosmos = let opt = Equinox.ResolveOption.AllowStale fun id -> Equinox.Cosmos.Resolver(context, Events.codec, Fold.fold, Fold.initial, cacheStrategy, accessStrategy).Resolve(id, opt) let create (context, cache) = - create (resolve (context, cache)) + create (resolver (context, cache)) diff --git a/equinox-fc/Domain/InventoryTransaction.fs b/equinox-fc/Domain/InventoryTransaction.fs index ecb9acbc1..a6f8d5bf3 100644 --- a/equinox-fc/Domain/InventoryTransaction.fs +++ b/equinox-fc/Domain/InventoryTransaction.fs @@ -148,10 +148,10 @@ module Cosmos = let accessStrategy = Equinox.Cosmos.AccessStrategy.Unoptimized // ... and there will generally be a single actor touching it at a given time, so we don't need to do a load (which would be more expensive than normal given the `accessStrategy`) before we sync let opt = Equinox.AllowStale - let resolve (context, cache) = + let resolver (context, cache) = let cacheStrategy = Equinox.Cosmos.CachingStrategy.SlidingWindow (cache, System.TimeSpan.FromMinutes 20.) fun id -> Equinox.Cosmos.Resolver(context, Events.codec, Fold.fold, Fold.initial, cacheStrategy, accessStrategy).Resolve(id, opt) - let createService (context, cache) = create (resolve (context, cache)) + let createService (context, cache) = create (resolver (context, cache)) /// Handles requirement to infer when a transaction is 'stuck' /// Note we don't want to couple to the state in a deep manner; thus we track: diff --git a/equinox-fc/Domain/LocationEpoch.fs b/equinox-fc/Domain/LocationEpoch.fs index a356c6a79..330e3dd2d 100644 --- a/equinox-fc/Domain/LocationEpoch.fs +++ b/equinox-fc/Domain/LocationEpoch.fs @@ -134,16 +134,16 @@ type Service internal (resolve : LocationId * LocationEpochId -> Equinox.Stream< stream.Transact(sync prevEpochBalanceCarriedForward decide shouldClose) let create resolver maxAttempts = - let resolve locId = - let stream = resolver (streamName locId) + let resolve locationId = + let stream = resolver (streamName locationId) Equinox.Stream(Serilog.Log.ForContext(), stream, maxAttempts = maxAttempts) Service (resolve) module Cosmos = let accessStrategy = Equinox.Cosmos.AccessStrategy.Unoptimized - let resolve (context, cache) = + let resolver (context, cache) = let cacheStrategy = Equinox.Cosmos.CachingStrategy.SlidingWindow (cache, System.TimeSpan.FromMinutes 20.) Equinox.Cosmos.Resolver(context, Events.codec, Fold.fold, Fold.initial, cacheStrategy, accessStrategy).Resolve let create (context, cache, maxAttempts) = - create (resolve (context, cache)) maxAttempts + create (resolver (context, cache)) maxAttempts diff --git a/equinox-fc/Domain/LocationSeries.fs b/equinox-fc/Domain/LocationSeries.fs index 35c77707f..e113a7c67 100644 --- a/equinox-fc/Domain/LocationSeries.fs +++ b/equinox-fc/Domain/LocationSeries.fs @@ -38,8 +38,8 @@ type Service internal (resolve : LocationId -> Equinox.Stream(), stream, maxAttempts = maxAttempts) Service (resolve) @@ -47,9 +47,9 @@ module Cosmos = open Equinox.Cosmos - let resolve (context, cache) = + let resolver (context, cache) = let cacheStrategy = CachingStrategy.SlidingWindow (cache, System.TimeSpan.FromMinutes 20.) let opt = Equinox.ResolveOption.AllowStale fun id -> Resolver(context, Events.codec, Fold.fold, Fold.initial, cacheStrategy, AccessStrategy.LatestKnownEvent).Resolve(id, opt) let createService (context, cache, maxAttempts) = - create (resolve (context, cache)) maxAttempts + create (resolver (context, cache)) maxAttempts