Skip to content

Commit

Permalink
Remove net461 Microsoft.Azure.DocumentDB 1.x support
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Feb 8, 2019
1 parent 316eb7b commit 1ad2638
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The `Unreleased` section name is replaced by the expected version of next releas

_NB at the present time, this project does not adhere strictly to Semantic Versioning - small binary-breaking changes may occur without a change in Major at the until this notice is removed (it will be!)._

## [Unreleased] - (tentatively `1.1.0`)
## [Unreleased] - (`1.1.0-preview*`)

### Added

Expand All @@ -20,20 +20,21 @@ _NB at the present time, this project does not adhere strictly to Semantic Versi
### Fixed

<a name="1.0.4"></a>
## [1.0.4] - TBA, planning 2019-02-06
## [1.0.4] - 2019-02-08

### Changed

- Rename `Equinox.CatId` to `Equinox.AggregateId` (HT @lfr for prompting the change)
- Use [`FSharp.UMX`](https://github.com/fsprojects/FSharp.UMX) from @alfonsogarciacaro and @eiriktsarpalis in tests/samples [#89](https://github.com/jet/equinox/pull/89) (HT @chinwobble in [#83](https://github.com/jet/equinox/pull/83) for prompting the change)
- Make `Newtonsoft.Json` dependency consistently `>= 11.0.2`
- Make `Microsoft.Azure.DocumentDB` dependency consistently `>= 2.0.0` (was temporarily 1.x on `net461` to fit in with constraints of a downstream)
- Refactor `Equinox.Cosmos` wiring to expose `EqxConnector.ConnectionPolicy`
- Use [`FSharp.UMX`](https://github.com/fsprojects/FSharp.UMX) from @alfonsogarciacaro and @eiriktsarpalis in tests/samples [#89](https://github.com/jet/equinox/pull/89) (HT @chinwobble in [#83](https://github.com/jet/equinox/pull/83) for prompting the change)

### Fixed

- Make `xUnit` dependency consistently `2.4.0`
- Improve CosmosDb connection string parse error message 5b1b56bd94350ef47bd84ddbbb5b028e45fbb462
- change from `licenseUrl` to `license` in `.nupkg`
- Make `xUnit` dependency consistently `2.4.0`

<a name="1.0.3"></a>
## [1.0.3] - 2019-01-19
Expand Down
2 changes: 1 addition & 1 deletion samples/Infrastructure/Storage.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module EventStore =
/// Standing up an Equinox instance is necessary to run for test purposes; You'll need to either:
/// 1) replace connection below with a connection string or Uri+Key for an initialized Equinox instance with a database and collection named "equinox-test"
/// 2) Set the 3x environment variables and create a local Equinox using tools/Equinox.Tool/bin/Release/net461/eqx.exe `
/// cosmos -s $env:EQUINOX_COSMOS_CONNECTION -d $env:EQUINOX_COSMOS_DATABASE -c $env:EQUINOX_COSMOS_COLLECTION provision -ru 1000
/// init -ru 1000 cosmos -s $env:EQUINOX_COSMOS_CONNECTION -d $env:EQUINOX_COSMOS_DATABASE -c $env:EQUINOX_COSMOS_COLLECTION
module Cosmos =
open Equinox.Cosmos

Expand Down
20 changes: 4 additions & 16 deletions src/Equinox.Cosmos/Cosmos.fs
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,14 @@ module private DocDb =
member __.TryReadDocument(documentId : string, ?options : Client.RequestOptions): Async<float * ReadResult<'T>> = async {
let options = defaultArg options null
let docLink = sprintf "%O/docs/%s" collectionUri documentId
#if NET461
try let! document = async { return! client.ReadDocumentAsync<'T>(docLink, options = options) |> Async.AwaitTaskCorrect }
#else
let! ct = Async.CancellationToken
try let! document = async { return! client.ReadDocumentAsync<'T>(docLink, options = options, cancellationToken = ct) |> Async.AwaitTaskCorrect }
#endif
if document.StatusCode = System.Net.HttpStatusCode.NotModified then return document.RequestCharge, NotModified
// NB `.Document` will NRE if a IfNoneModified precondition triggers a NotModified result
else return document.RequestCharge, Found document.Document
with
| DocDbException (DocDbStatusCode System.Net.HttpStatusCode.NotFound as e) -> return e.RequestCharge, NotFound
// NB while the docs suggest you may see a 412, the NotModified in the body of the try/with is actually what happens
| DocDbException (DocDbStatusCode System.Net.HttpStatusCode.PreconditionFailed as e) -> return e.RequestCharge, NotModified }
with DocDbException (DocDbStatusCode System.Net.HttpStatusCode.NotFound as e) -> return e.RequestCharge, NotFound
// NB while the docs suggest you may see a 412, the NotModified in the body of the try/with is actually what happens
| DocDbException (DocDbStatusCode System.Net.HttpStatusCode.PreconditionFailed as e) -> return e.RequestCharge, NotModified }

module Sync =
// NB don't nest in a private module, or serialization will fail miserably ;)
Expand Down Expand Up @@ -367,15 +362,9 @@ function sync(req, expectedVersion, maxEvents) {
let sprocLink = sprintf "%O/sprocs/%s" stream.collectionUri sprocName
let opts = Client.RequestOptions(PartitionKey=PartitionKey(stream.name))
let ev = match expectedVersion with Some ev -> Position.fromI ev | None -> Position.fromAppendAtEnd
#if NET461
let! (res : Client.StoredProcedureResponse<SyncResponse>) =
client.ExecuteStoredProcedureAsync(sprocLink, opts, box req, box ev.index, box maxEvents) |> Async.AwaitTaskCorrect
#else
let! ct = Async.CancellationToken
let! (res : Client.StoredProcedureResponse<SyncResponse>) =
client.ExecuteStoredProcedureAsync(sprocLink, opts, ct, box req, box ev.index, box maxEvents) |> Async.AwaitTaskCorrect
#endif

let newPos = { index = res.Response.n; etag = Option.ofObj res.Response.etag }
return res.RequestCharge, res.Response.conflicts |> function
| null -> Result.Written newPos
Expand Down Expand Up @@ -608,8 +597,7 @@ module internal Tip =
let mutable ru = 0.
let allSlices = ResizeArray()
let startTicks = System.Diagnostics.Stopwatch.GetTimestamp()
try
let readlog = log |> Log.prop "direction" direction
try let readlog = log |> Log.prop "direction" direction
let mutable ok = true
while ok do
incr responseCount
Expand Down
4 changes: 2 additions & 2 deletions src/Equinox.Cosmos/Equinox.Cosmos.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<GenerateDocumentationFile Condition=" '$(Configuration)' == 'Release' ">true</GenerateDocumentationFile>
<WarningLevel>5</WarningLevel>
<IsTestProject>false</IsTestProject>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
<GenerateDocumentationFile Condition=" '$(Configuration)' == 'Release' ">true</GenerateDocumentationFile>
<DefineConstants Condition=" '$(TargetFramework)' == 'net461' ">$(DefineConstants);NET461</DefineConstants>
</PropertyGroup>

Expand All @@ -28,7 +28,7 @@
<PackageReference Include="FSharp.Core" Version="3.1.2.5" Condition=" '$(TargetFramework)' != 'netstandard2.0' " />
<PackageReference Include="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />
<PackageReference Include="FSharp.Control.AsyncSeq" Version="2.0.21" />
<PackageReference Include="Microsoft.Azure.DocumentDB" Version="1.17" Condition=" '$(TargetFramework)' != 'netstandard2.0' " />
<PackageReference Include="Microsoft.Azure.DocumentDB" Version="2.0.0" Condition=" '$(TargetFramework)' != 'netstandard2.0' " />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.0.0" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />
<PackageReference Include="System.Runtime.Caching" Version="4.5.0" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />
<Reference Include="System.Runtime.Caching" Condition=" '$(TargetFramework)' != 'netstandard2.0' " />
Expand Down

0 comments on commit 1ad2638

Please sign in to comment.