From df662b7591689dbfcfedfcc7c6e499714c7b9074 Mon Sep 17 00:00:00 2001 From: Ruben Bartelink Date: Sun, 23 Jan 2022 22:32:18 +0000 Subject: [PATCH] Fix names, samples, deps --- DOCUMENTATION.md | 11 +++++------ README.md | 2 +- src/Equinox.CosmosStore/CosmosStore.fs | 2 +- .../CosmosCoreIntegration.fs | 3 +-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 831fb07eb..1b5c660f8 100755 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -1809,13 +1809,12 @@ following key benefits: ```fsharp open Equinox.CosmosStore.Core -// open MyCodecs.Json // example of using specific codec which can yield UTF-8 - // byte arrays from a type using `Json.toBytes` via Fleece - // or similar +// open MyCodecs.Json // example of using specific codecs that can yield JsonElements + // from a type using `Json.toBytes` using FsCodec or similar type EventData with static member FromT eventType value = - EventData.FromUtf8Bytes(eventType, Json.toBytes value) + EventData.FromJsonElement(eventType, Request.toJsonElement value) // Load connection sring from your Key Vault (example here is the CosmosDB // simulator's well known key) @@ -1849,8 +1848,8 @@ let ctx = EventsContext(storeClient, gatewayLog) // let expectedSequenceNumber = 0 // new stream -let streamName, eventType, eventJson = "stream-1", "myEvent", Request.ToJson event -let eventData = EventData.fromT(eventType, eventJson) |> Array.singleton +let streamName, eventType, eventJson = "stream-1", "myEvent", Request.ToJsonElement event +let eventData = EventData.FromJsonElement(eventType, eventJson) |> Array.singleton let! res = Events.append diff --git a/README.md b/README.md index b59b25dad..cfa8c12ed 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ The components within this repository are delivered as multi-targeted Nuget pack - `Equinox.Core` [![NuGet](https://img.shields.io/nuget/v/Equinox.Core.svg)](https://www.nuget.org/packages/Equinox.Core/): Interfaces and helpers used in the concrete Store implementations, together with the default [`System.Runtime.Caching.Cache`-based] `Cache` implementation. Hosts generic utility types frequently useful alongside Equinox: [`AsyncCacheCell`](https://github.com/jet/equinox/blob/master/src/Equinox.Core/AsyncCacheCell.fs#L36), [`AsyncBatchingGate`](https://github.com/jet/equinox/blob/master/src/Equinox.Core/AsyncBatchingGate.fs#L41). ([depends](https://www.fuget.org/packages/Equinox.Core) on `Equinox`, `System.Runtime.Caching`) - `Equinox.MemoryStore` [![MemoryStore NuGet](https://img.shields.io/nuget/v/Equinox.MemoryStore.svg)](https://www.nuget.org/packages/Equinox.MemoryStore/): In-memory store for integration testing/performance base-lining/providing out-of-the-box zero dependency storage for examples. ([depends](https://www.fuget.org/packages/Equinox.MemoryStore) on `Equinox.Core`, `FsCodec`) - `Equinox.EventStore` [![EventStore NuGet](https://img.shields.io/nuget/v/Equinox.EventStore.svg)](https://www.nuget.org/packages/Equinox.EventStore/): [EventStoreDB](https://eventstore.org/) Adapter designed to meet Jet's production monitoring requirements. ([depends](https://www.fuget.org/packages/Equinox.EventStore) on `Equinox.Core`, `EventStore.Client >= 20.6`, `FSharp.Control.AsyncSeq >= 2.0.23`) -- `Equinox.CosmosStore` [![CosmosStore NuGet](https://img.shields.io/nuget/v/Equinox.CosmosStore.svg)](https://www.nuget.org/packages/Equinox.CosmosStore/): Azure CosmosDB Adapter with integrated 'unfolds' feature, facilitating optimal read performance in terms of latency and RU costs, instrumented to meet Jet's production monitoring requirements. ([depends](https://www.fuget.org/packages/Equinox.CosmosStore) on `Equinox.Core`, `Microsoft.Azure.Cosmos >= 3.17`, `FsCodec.NewtonsoftJson`, `FSharp.Control.AsyncSeq >= 2.0.23`) +- `Equinox.CosmosStore` [![CosmosStore NuGet](https://img.shields.io/nuget/v/Equinox.CosmosStore.svg)](https://www.nuget.org/packages/Equinox.CosmosStore/): Azure CosmosDB Adapter with integrated 'unfolds' feature, facilitating optimal read performance in terms of latency and RU costs, instrumented to meet Jet's production monitoring requirements. ([depends](https://www.fuget.org/packages/Equinox.CosmosStore) on `Equinox.Core`, `Microsoft.Azure.Cosmos >= 3.17`, `FsCodec >= 2.3.0`, `System.Text.Json >= 6.0.1`, `FSharp.Control.AsyncSeq >= 2.0.23`) - `Equinox.CosmosStore.Prometheus` [![CosmosStore.Prometheus NuGet](https://img.shields.io/nuget/v/Equinox.CosmosStore.Prometheus.svg)](https://www.nuget.org/packages/Equinox.CosmosStore.Prometheus/): Integration package providing a `Serilog.Core.ILogEventSink` that extracts detailed metrics information attached to the `LogEvent`s and feeds them to the `prometheus-net`'s `Prometheus.Metrics` static instance. ([depends](https://www.fuget.org/packages/Equinox.CosmosStore.Prometheus) on `Equinox.CosmosStore`, `prometheus-net >= 3.6.0`) - `Equinox.SqlStreamStore` [![SqlStreamStore NuGet](https://img.shields.io/nuget/v/Equinox.SqlStreamStore.svg)](https://www.nuget.org/packages/Equinox.SqlStreamStore/): [SqlStreamStore](https://github.com/SQLStreamStore/SQLStreamStore) Adapter derived from `Equinox.EventStore` - provides core facilities (but does not connect to a specific database; see sibling `SqlStreamStore`.* packages). ([depends](https://www.fuget.org/packages/Equinox.SqlStreamStore) on `Equinox.Core`, `FsCodec`, `SqlStreamStore >= 1.2.0-beta.8`, `FSharp.Control.AsyncSeq`) - `Equinox.SqlStreamStore.MsSql` [![MsSql NuGet](https://img.shields.io/nuget/v/Equinox.SqlStreamStore.MsSql.svg)](https://www.nuget.org/packages/Equinox.SqlStreamStore.MsSql/): [SqlStreamStore.MsSql](https://sqlstreamstore.readthedocs.io/en/latest/sqlserver) Sql Server `Connector` implementation for `Equinox.SqlStreamStore` package). ([depends](https://www.fuget.org/packages/Equinox.SqlStreamStore.MsSql) on `Equinox.SqlStreamStore`, `SqlStreamStore.MsSql >= 1.2.0-beta.8`) diff --git a/src/Equinox.CosmosStore/CosmosStore.fs b/src/Equinox.CosmosStore/CosmosStore.fs index a3cc4b0d7..676abad8d 100644 --- a/src/Equinox.CosmosStore/CosmosStore.fs +++ b/src/Equinox.CosmosStore/CosmosStore.fs @@ -1592,7 +1592,7 @@ type EventsContext internal /// Provides mechanisms for building `EventData` records to be supplied to the `Events` API type EventData() = /// Creates an Event record, suitable for supplying to Append et al - static member FromUtf8Bytes(eventType, data, ?meta) : IEventData<_> = FsCodec.Core.EventData.Create(eventType, data, ?meta = meta) :> _ + static member FromJsonElements(eventType, data, ?meta) : IEventData<_> = FsCodec.Core.EventData.Create(eventType, data, ?meta = meta) :> _ /// Api as defined in the Equinox Specification /// Note the CosmosContext APIs can yield better performance due to the fact that a Position tracks the etag of the Stream's Tip diff --git a/tests/Equinox.CosmosStore.Integration/CosmosCoreIntegration.fs b/tests/Equinox.CosmosStore.Integration/CosmosCoreIntegration.fs index 00343f958..7c7aaebe5 100644 --- a/tests/Equinox.CosmosStore.Integration/CosmosCoreIntegration.fs +++ b/tests/Equinox.CosmosStore.Integration/CosmosCoreIntegration.fs @@ -8,14 +8,13 @@ open Newtonsoft.Json.Linq open Swensen.Unquote open Serilog open System -open System.Text #nowarn "1182" // From hereon in, we may have some 'unused' privates (the tests) type TestEvents() = static member private Create(i, ?eventType, ?json) = let ser = System.Text.Json.JsonSerializer.SerializeToElement - EventData.FromUtf8Bytes + EventData.FromJsonElements ( sprintf "%s:%d" (defaultArg eventType "test_event") i, ser <| defaultArg json "{\"d\":\"d\"}", ser "{\"m\":\"m\"}")