Skip to content
Draft
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
0cd50f9
Target FSharp.Control.AsyncSeq 2.0.23
bartelink Feb 19, 2020
48fea8d
Change Cosmos to netstandard2.1, tools to netcoreapp3.1
bartelink Feb 19, 2020
59fda04
Make tests pass
bartelink Aug 16, 2019
723c7d8
Reduce leniency on stored proc call
bartelink Aug 20, 2019
3baeb3e
V4
bartelink Feb 11, 2020
fa23d16
Up to L365
bartelink Feb 11, 2020
bbd90c6
Correctly retrieve request charge from Azure.Core response types; Swi…
ylibrach Feb 11, 2020
8485484
Migrate to new etag match predicate
ylibrach Feb 12, 2020
65c27d6
Migrate from FeedIterator to IAsyncEnumerable
ylibrach Feb 12, 2020
4aa3319
Only set gateway options when in Gateway mode
ylibrach Feb 18, 2020
26fd82e
Add and use NewtonsoftJsonSerializer
ylibrach Feb 18, 2020
f2a0633
Rearrange files
ylibrach Feb 18, 2020
482b797
Fix test RU limits
ylibrach Feb 18, 2020
a36e742
Remove Microsoft.Azure.Cosmos.Direct ref
bartelink Feb 19, 2020
f09a731
Change from byte[] payloads to STJ.JsonElement; Rewrite converters us…
ylibrach Feb 25, 2020
aec8068
Replace FSCodec.NewtonsoftJson with core FSCodec
ylibrach Feb 25, 2020
2035d49
Remove NewtonsoftJsonSerializer
ylibrach Feb 25, 2020
b61e367
Update FsCodec to 2.0.1
ylibrach Feb 26, 2020
c37789d
Fully switch over to STJ
ylibrach Feb 27, 2020
561e17c
Update tests
ylibrach Feb 27, 2020
c121ca2
Create Tutorial STJ codecs
ylibrach Feb 27, 2020
48a874e
Create Store integration STJ codecs
ylibrach Feb 28, 2020
b231595
Move STJ code to Equinox
ylibrach Feb 28, 2020
dd97e50
Add FsCodec.STJ to Equinox
ylibrach Feb 28, 2020
7973a73
Move FsCodec.STJ to Equinox.Core; Fix net461
ylibrach Feb 28, 2020
e2d3d6b
Pair codecs together with Event types
ylibrach Feb 28, 2020
125e3b0
Pair codecs together with Event types
ylibrach Mar 2, 2020
a68f80a
Split resolvers into UTF8 and JsonElement
ylibrach Mar 2, 2020
301fdc5
Remove unnecessary async block
ylibrach Mar 2, 2020
1c92b08
Fix typo
ylibrach Mar 2, 2020
d95e121
Change to camelCase field names
ylibrach Mar 2, 2020
4398d30
Move FsCodec dep to end
ylibrach Mar 2, 2020
3fabd8f
Rearrange open statements
ylibrach Mar 2, 2020
b0a3a9b
Merge pull request #200 from jet/stj
ylibrach Mar 3, 2020
d599f6c
Fix ValueTask versioning
ylibrach Mar 3, 2020
a670bcd
Merge branch 'master' into cosmossdk4
bartelink Mar 5, 2020
b1f4f03
Abstract Cosmos clients and allow them to be provided by consumers
ylibrach Mar 6, 2020
88ec2bf
Clean up CancellationToken usages
ylibrach Mar 9, 2020
c509a1b
Streamline clients
ylibrach Mar 9, 2020
0a5a176
Move all initialization functions to separate module
ylibrach Mar 10, 2020
4b92f85
Make abstractions more generic
ylibrach Mar 10, 2020
618c535
Rename to EquinoxCosmosClientFactory
ylibrach Mar 10, 2020
474575a
Fix spacing
ylibrach Mar 10, 2020
a423299
Add argument docs
ylibrach Mar 10, 2020
138a01e
Inline map/bind 'help'ers
bartelink Mar 11, 2020
d7d92bb
Merge remote-tracking branch 'origin/master' into cosmossdk4
bartelink Mar 11, 2020
4b84edd
Rebase on Codec logic extracted into FsCodec.System.Text.Json (#202)
bartelink Mar 12, 2020
cd998c8
Merge remote-tracking branch 'origin/master' into cosmossdk4
bartelink Mar 12, 2020
5e42546
Merge branch 'master' of https://github.com/jet/equinox into cosmossdk4
ylibrach Mar 13, 2020
28499e6
Remove net461 target from tests
ylibrach Mar 13, 2020
a2d742f
Fix various test issues
ylibrach Mar 17, 2020
2f3cfaa
Provide options
ylibrach Mar 17, 2020
d044dfd
Merge with latest changes from cosmossdk4
ylibrach Mar 17, 2020
6207c09
Merge branch 'client-abstractions' of https://github.com/jet/equinox …
ylibrach Mar 17, 2020
a188f69
Tip compression toggle through optional argument (#206)
ylibrach Mar 19, 2020
0a7fa6d
Change container initialization to be explicitly called on demand
ylibrach Mar 19, 2020
d6637ee
Switch from Force() to Value
ylibrach Mar 19, 2020
3374a6d
Rename Client to Operations
ylibrach Mar 19, 2020
a17704b
Remove Sdk from naming
ylibrach Mar 19, 2020
e4270f9
Rename to compressUnfolds for clarity
ylibrach Mar 19, 2020
5f7469f
Merge pull request #203 from jet/client-abstractions
ylibrach Mar 19, 2020
820db24
Target FsCodec 2.0.2-alpha.0.8
bartelink Mar 19, 2020
634ae3d
Misc cleanup
bartelink Mar 19, 2020
a5374fb
Store.Operations ?
bartelink Mar 19, 2020
a94843a
Store* naming
bartelink Mar 19, 2020
0b1a400
Move Converter out of type definitions
bartelink Mar 19, 2020
e40d9d9
Fix naming stragglers
bartelink Mar 19, 2020
6a36d46
Add dump -b to enable overriding Cosmos MaxItems
bartelink Apr 1, 2020
ad1dae4
Merge branch 'master' into cosmossdk4
bartelink Apr 1, 2020
18eb774
Merge remote-tracking branch 'origin/master' into cosmossdk4
bartelink Apr 6, 2020
07c8492
Cosmos V4: Reduce initialization confusion (#208)
bartelink Apr 7, 2020
1e24121
simplify GetContainer
bartelink Apr 6, 2020
73fa4be
Merge remote-tracking branch 'origin/master' into cosmossdk4
bartelink Apr 7, 2020
84c3b73
Cosmos -> CosmosStore and related renames (#216)
bartelink Apr 15, 2020
358bbe2
Merge with FsCodec 2.1.0 release updates
bartelink May 10, 2020
730079f
Remove CancellationToken.useOrCreate
bartelink May 10, 2020
3b5cb66
Merge branch 'master' into cosmossdk4
bartelink Jun 3, 2020
d2e96f2
Implement pretty-printing for JsonElement
bartelink Jun 25, 2020
511e122
Merge branch 'master' into cosmossdk4
bartelink Jun 26, 2020
31c94ce
Tidy comments
bartelink Sep 2, 2020
4eae601
Tidy
bartelink Sep 3, 2020
6622026
Polish comments
bartelink Sep 3, 2020
175eefc
Merge remote-tracking branch 'origin/master' into cosmossdk4
bartelink Sep 15, 2020
e7009b7
Upgrade to STJ 5.0 rc1
bartelink Sep 15, 2020
75d4551
Fix json
bartelink Sep 17, 2020
792e420
Really Fix json
bartelink Sep 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion samples/Infrastructure/Infrastructure.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
<PackageReference Include="Microsoft.Azure.Cosmos.Direct" Version="3.1.4" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions samples/Infrastructure/Storage.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Cosmos =

type [<NoEquality; NoComparison>] Arguments =
| [<AltCommandLine "-V">] VerboseStore
| [<AltCommandLine "-m">] ConnectionMode of Microsoft.Azure.Cosmos.ConnectionMode
| [<AltCommandLine "-m">] ConnectionMode of Azure.Cosmos.ConnectionMode
| [<AltCommandLine "-o">] Timeout of float
| [<AltCommandLine "-r">] Retries of int
| [<AltCommandLine "-rt">] RetriesWaitTimeS of float
Expand All @@ -54,7 +54,7 @@ module Cosmos =
| Database _ -> "specify a database name for store. (optional if environment variable EQUINOX_COSMOS_DATABASE specified)"
| Container _ -> "specify a container name for store. (optional if environment variable EQUINOX_COSMOS_CONTAINER specified)"
type Info(args : ParseResults<Arguments>) =
member __.Mode = args.GetResult(ConnectionMode,Microsoft.Azure.Cosmos.ConnectionMode.Direct)
member __.Mode = args.GetResult(ConnectionMode,Azure.Cosmos.ConnectionMode.Direct)
member __.Connection = args.TryGetResult Connection |> defaultWithEnvVar "EQUINOX_COSMOS_CONNECTION" "Connection"
member __.Database = args.TryGetResult Database |> defaultWithEnvVar "EQUINOX_COSMOS_DATABASE" "Database"
member __.Container = args.TryGetResult Container |> defaultWithEnvVar "EQUINOX_COSMOS_CONTAINER" "Container"
Expand Down
1 change: 1 addition & 0 deletions src/Equinox.Core/Infrastructure.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ open FSharp.Control
open System
open System.Diagnostics
open System.Threading.Tasks
open System.Threading

type OAttribute = System.Runtime.InteropServices.OptionalAttribute
type DAttribute = System.Runtime.InteropServices.DefaultParameterValueAttribute
Expand Down
198 changes: 111 additions & 87 deletions src/Equinox.Cosmos/Cosmos.fs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/Equinox.Cosmos/Equinox.Cosmos.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<ItemGroup>
<Compile Include="..\Equinox.Core\Infrastructure.fs" Link="Infrastructure.fs" />
<Compile Include="NewtonsoftJsonSerializer.fs" />
<Compile Include="Cosmos.fs" />
</ItemGroup>

Expand All @@ -19,15 +20,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="2.0.0" PrivateAssets="All" />

<PackageReference Include="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.0" />

<PackageReference Include="FsCodec.NewtonsoftJson" Version="2.0.0" />
<PackageReference Include="FSharp.Control.AsyncSeq" Version="2.0.23" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.1.1" />
<PackageReference Include="Azure.Cosmos" Version="4.0.0-preview3" />
<PackageReference Include="System.Runtime.Caching" Version="4.5.0" />
</ItemGroup>

Expand Down
39 changes: 39 additions & 0 deletions src/Equinox.Cosmos/NewtonsoftJsonSerializer.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace Equinox.Cosmos.Store

open System.IO;
open System.Text;
open Azure.Cosmos.Serialization;
open Newtonsoft.Json;
open Newtonsoft.Json.Serialization;

type NewtonsoftJsonSerializer () =
inherit CosmosSerializer ()

let encoding = new UTF8Encoding(false, true)
let serializer = JsonSerializer.Create()

override __.FromStream<'T> (stream: Stream): 'T =
use stream = stream

if typeof<Stream>.IsAssignableFrom(typeof<'T>) then
stream :> obj :?> 'T
else
use streamReader = new StreamReader(stream)
use jsonReader = new JsonTextReader(streamReader)
serializer.Deserialize<'T>(jsonReader)

override __.ToStream<'T> (input: 'T): Stream =
let payload = new MemoryStream()

(
use streamWriter = new StreamWriter(payload, encoding = encoding, bufferSize = 1024, leaveOpen = true)
use jsonWriter = new JsonTextWriter(streamWriter)

jsonWriter.Formatting <- Formatting.None
serializer.Serialize(jsonWriter, input)
jsonWriter.Flush()
streamWriter.Flush()
)

payload.Position <- 0L
payload :> Stream
10 changes: 5 additions & 5 deletions tests/Equinox.Cosmos.Integration/CosmosCoreIntegration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ type Tests(testOutputHelper) =

// 2 items atm
test <@ [EqxAct.ResponseForward; EqxAct.ResponseForward; EqxAct.QueryForward] = capture.ExternalCalls @>
verifyRequestChargesMax 6 } // 5.77
verifyRequestChargesMax 9 } // 8.51 // WAS 6 // 5.77

[<AutoData(SkipIfRequestedViaEnvironmentVariable="EQUINOX_INTEGRATION_SKIP_COSMOS")>]
let ``get Lazy`` (TestStream streamName) = Async.RunSynchronously <| async {
Expand All @@ -258,7 +258,7 @@ type Tests(testOutputHelper) =
| _ -> None
// validate that, despite only requesting max 1 item, we only needed one trip (which contained only one item)
[1,1] =! capture.ChooseCalls queryRoundTripsAndItemCounts
verifyRequestChargesMax 4 // 3.02 // WAS 3 // 2.97
verifyRequestChargesMax 6 // 5.74 // WAS 4 // 3.02 // WAS 3 // 2.97
}

(* Backward *)
Expand All @@ -279,7 +279,7 @@ type Tests(testOutputHelper) =
verifyCorrectEventsBackward 4L expected res

test <@ [EqxAct.ResponseBackward; EqxAct.QueryBackward] = capture.ExternalCalls @>
verifyRequestChargesMax 4 // 3.04 // WAS 3
verifyRequestChargesMax 6 // 5.75 // WAS 4 // 3.04 // WAS 3
}

[<AutoData(SkipIfRequestedViaEnvironmentVariable="EQUINOX_INTEGRATION_SKIP_COSMOS")>]
Expand Down Expand Up @@ -323,5 +323,5 @@ type Tests(testOutputHelper) =
| EqxEvent (Equinox.Cosmos.Store.Log.Event.Query (Equinox.Cosmos.Store.Direction.Backward, responses, { count = c })) -> Some (responses,c)
| _ -> None
[1,5] =! capture.ChooseCalls queryRoundTripsAndItemCounts
verifyRequestChargesMax 4 // 3.04 // WAS 3 // 2.98
}
verifyRequestChargesMax 6 // 5.76 // WAS 4 // 3.04 // WAS 3 // 2.98
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<PackageReference Include="FsCheck.xUnit" Version="2.14.0" />
<PackageReference Include="JsonDiffPatch.Net" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Microsoft.Azure.Cosmos.Direct" Version="3.1.4" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
<PackageReference Include="unquote" Version="4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down
2 changes: 1 addition & 1 deletion tools/Equinox.Tool/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ module SqlInit =
| _ -> failwith "please specify a `ms`,`my` or `pg` endpoint" }

module CosmosStats =
type Microsoft.Azure.Cosmos.Container with
type Azure.Cosmos.CosmosContainer with
// NB DO NOT CONSIDER PROMULGATING THIS HACK
member container.QueryValue<'T>(sqlQuery : string) =
let query : seq<'T> = failwith "TODO translate" //container.ReadItemAsync(sqlQuery) :> _
Expand Down