From ce5a9678b39e08bbcd373fd90fddcbf6e40c4bc8 Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Fri, 6 Sep 2024 14:01:20 +0100 Subject: [PATCH 1/2] refactor(MemoryStore): remove unused args --- src/Equinox.MemoryStore/MemoryStore.fs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Equinox.MemoryStore/MemoryStore.fs b/src/Equinox.MemoryStore/MemoryStore.fs index d108c205d..855a9bcca 100644 --- a/src/Equinox.MemoryStore/MemoryStore.fs +++ b/src/Equinox.MemoryStore/MemoryStore.fs @@ -37,7 +37,7 @@ type VolatileStore<'Format>() = events /// Attempts a synchronization operation - yields conflicting value if expectedCount does not match - member _.TrySync(streamName, _categoryName, _streamId, expectedCount, events): struct (bool * FsCodec.ITimelineEvent<'Format>[]) = + member _.TrySync(streamName, expectedCount, events): struct (bool * FsCodec.ITimelineEvent<'Format>[]) = // Where attempts overlap on the same stream, there's a race to raise the Committed event for each 'commit' // If we don't serialize the publishing of the events, its possible for handlers to observe the Events out of order // NOTE while a Channels based impl might offer better throughput at load, in practical terms serializing all Committed event notifications @@ -47,6 +47,8 @@ type VolatileStore<'Format>() = let struct (succeeded, _) as outcome = trySync streamName expectedCount events if succeeded then committed.Trigger(FsCodec.StreamName.Internal.trust streamName, events) outcome + [] + member x.TrySync(streamName, _categoryName, _streamId, expectedCount, events): struct (bool * FsCodec.ITimelineEvent<'Format>[]) = x.TrySync(streamName, expectedCount, events) type private StoreCategory<'event, 'state, 'req, 'Format>(store: VolatileStore<'Format>, codec, fold, initial) = let fold s xs = (fold : System.Func<'state, 'event[], 'state>).Invoke(s, xs) @@ -60,7 +62,7 @@ type private StoreCategory<'event, 'state, 'req, 'Format>(store: VolatileStore<' | xs -> return res xs.Length initial (decode xs) } member _.Sync(_log, categoryName, streamId, streamName, req, token, state, events, _ct) = task { let encoded = events |> Array.mapi (fun i e -> FsCodec.Core.TimelineEvent.Create(token.version + int64 i, codec.Encode(req, e))) - match store.TrySync(streamName, categoryName, streamId, int token.version, encoded) with + match store.TrySync(streamName, int token.version, encoded) with | true, streamEvents' -> return SyncResult.Written (res streamEvents'.Length state events) | false, conflictingEvents -> From 56982fd61d3677c92272dc399f2c207a9128359d Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Wed, 30 Oct 2024 07:42:36 +0000 Subject: [PATCH 2/2] CL --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae0c4cb17..7a0f6e35c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The `Unreleased` section name is replaced by the expected version of next releas - `Equinox.*Store`,`Equinox.*Store.Prometheus`: Pin `Equinox` dependencies to `[4.0.0, 5.0.0)`] [#448](https://github.com/jet/equinox/pull/448) - `Equinox.CosmosStore`: Update `System.Text.Json` dep to `6.0.10` per [CVE-2024-43485](https://github.com/advisories/GHSA-8g4q-xg66-9fp4) [#470](https://github.com/jet/equinox/pull/470) - `Equinox.MessageDb`: Up min `Npgsql` to v `7.0.7` as `7.0.0` is on CVE blacklist +- `Equinox.MemoryStore`: Remove unused TrySync args [#466](https://github.com/jet/equinox/pull/466) ### Removed