Skip to content

Commit

Permalink
Target FsCodec.* 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Feb 19, 2020
1 parent dc3967a commit 66a8e71
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 23 deletions.
18 changes: 12 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ The `Unreleased` section name is replaced by the expected version of next releas

## [Unreleased]

### Added
### Changed
### Removed
### Fixed

<a name="2.0.0"></a>
## [2.0.0] - 2020-02-19

### Added

- `Stream.TransactAsyncEx`, exposing the `Core.ISyncContext` at conclusion of the sync operation, affording the ability to examine the post-state `Version` etc. (This paves the way for exposing [`SessionToken`](https://github.com/jet/equinox/issues/192) at a later point without a breaking change) [#194](https://github.com/jet/equinox/pull/194)

### Changed

- `Stream.QueryEx` to supply `Core.ISyncContext` in lieu of only exposing `Version` (to align with `TransactAsyncEx`) [#194](https://github.com/jet/equinox/pull/194)
- `Stream.QueryEx` to supply `Core.ISyncContext` in lieu of only exposing `Version` (to align with `TransactAsyncEx`) [#194](https://github.com/jet/equinox/pull/194)
- Target `FsCodec` v `2.0.0`

### Removed
### Fixed

<a name="2.0.0"></a>
<a name="2.0.0-rc9"></a>
## [2.0.0-rc9] - 2020-01-31

Expand Down Expand Up @@ -362,7 +367,8 @@ The `Unreleased` section name is replaced by the expected version of next releas

(For information pertaining to earlier releases, see release notes in https://github.com/jet/equinox/releases and/or can someone please add it!)

[Unreleased]: https://github.com/jet/equinox/compare/2.0.0-rc9...HEAD
[Unreleased]: https://github.com/jet/equinox/compare/2.0.0...HEAD
[2.0.0]: https://github.com/jet/equinox/compare/2.0.0-rc9...2.0.0
[2.0.0-rc9]: https://github.com/jet/equinox/compare/2.0.0-rc8...2.0.0-rc9
[2.0.0-rc8]: https://github.com/jet/equinox/compare/2.0.0-rc7...2.0.0-rc8
[2.0.0-rc7]: https://github.com/jet/equinox/compare/2.0.0-rc6...2.0.0-rc7
Expand Down
3 changes: 1 addition & 2 deletions samples/Store/Domain/Domain.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
<PackageReference Include="FSharp.Core" Version="3.1.2.5" Condition=" '$(TargetFramework)' == 'net461' " />
<PackageReference Include="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />

<PackageReference Include="FsCodec.NewtonsoftJson" Version="2.0.0-rc3" />
<PackageReference Include="FSharp.UMX" Version="1.0.0" />
<PackageReference Include="FsCodec.NewtonsoftJson" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions src/Equinox.Cosmos/Cosmos.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ type [<NoEquality; NoComparison; JsonObject(ItemRequired=Required.Always)>]
member __.EventType = __.c
member __.Data = __.d
member __.Meta = __.m
member __.Timestamp = __.t
member __.EventId = Guid.Empty
member __.CorrelationId = __.correlationId
member __.CausationId = __.causationId
member __.Timestamp = __.t

/// A 'normal' (frozen, not Tip) Batch of Events (without any Unfolds)
type [<NoEquality; NoComparison; JsonObject(ItemRequired=Required.Always)>]
Expand Down Expand Up @@ -185,7 +186,7 @@ type Direction = Forward | Backward override this.ToString() = match this with F

type internal Enum() =
static member internal Events(b: Tip) : ITimelineEvent<byte[]> seq =
b.e |> Seq.mapi (fun offset x -> FsCodec.Core.TimelineEvent.Create(b.i + int64 offset, x.c, x.d, x.m, x.correlationId, x.causationId, x.t))
b.e |> Seq.mapi (fun offset x -> FsCodec.Core.TimelineEvent.Create(b.i + int64 offset, x.c, x.d, x.m, Guid.Empty, x.correlationId, x.causationId, x.t))
static member Events(i: int64, e: Event[], startPos : Position option, direction) : ITimelineEvent<byte[]> seq = seq {
// If we're loading from a nominated position, we need to discard items in the batch before/after the start on the start page
let isValidGivenStartPos i =
Expand All @@ -197,12 +198,12 @@ type internal Enum() =
let index = i + int64 offset
if isValidGivenStartPos index then
let x = e.[offset]
yield FsCodec.Core.TimelineEvent.Create(index, x.c, x.d, x.m, x.correlationId, x.causationId, x.t) }
yield FsCodec.Core.TimelineEvent.Create(index, x.c, x.d, x.m, Guid.Empty, x.correlationId, x.causationId, x.t) }
static member internal Events(b: Batch, startPos, direction) =
Enum.Events(b.i, b.e, startPos, direction)
|> if direction = Direction.Backward then System.Linq.Enumerable.Reverse else id
static member Unfolds(xs: Unfold[]) : ITimelineEvent<byte[]> seq = seq {
for x in xs -> FsCodec.Core.TimelineEvent.Create(x.i, x.c, x.d, x.m, null, null, x.t, isUnfold=true) }
for x in xs -> FsCodec.Core.TimelineEvent.Create(x.i, x.c, x.d, x.m, Guid.Empty, null, null, x.t, isUnfold=true) }
static member EventsAndUnfolds(x: Tip): ITimelineEvent<byte[]> seq =
Enum.Events x
|> Seq.append (Enum.Unfolds x.u)
Expand Down
2 changes: 1 addition & 1 deletion src/Equinox.Cosmos/Equinox.Cosmos.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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="FsCodec.NewtonsoftJson" Version="2.0.0-rc3" />
<PackageReference Include="FsCodec.NewtonsoftJson" Version="2.0.0" />
<PackageReference Include="FSharp.Control.AsyncSeq" Version="2.0.21" />
<PackageReference Include="Microsoft.Azure.DocumentDB" Version="2.2.0" Condition=" '$(TargetFramework)' != 'netstandard2.0' " />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.2.0" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />
Expand Down
2 changes: 1 addition & 1 deletion src/Equinox.EventStore/Equinox.EventStore.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageReference Include="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />

<PackageReference Include="EventStore.Client" Version="5.0.1" />
<PackageReference Include="FsCodec" Version="2.0.0-rc3" />
<PackageReference Include="FsCodec" Version="2.0.0" />
<PackageReference Include="FSharp.Control.AsyncSeq" Version="2.0.21" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Equinox.EventStore/EventStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,12 @@ module UnionEncoderAdapters =
let ts = DateTimeOffset.FromUnixTimeMilliseconds(e.CreatedEpoch)
// TOCONSIDER wire e.Metadata.["$correlationId"] and .["$causationId"] into correlationId and causationId
// https://eventstore.org/docs/server/metadata-and-reserved-names/index.html#event-metadata
FsCodec.Core.TimelineEvent.Create(e.EventNumber, e.EventType, e.Data, e.Metadata, correlationId = null, causationId = null, timestamp = ts)
FsCodec.Core.TimelineEvent.Create(e.EventNumber, e.EventType, e.Data, e.Metadata, e.EventId, correlationId = null, causationId = null, timestamp = ts)

let eventDataOfEncodedEvent (x : FsCodec.IEventData<byte[]>) =
// TOCONSIDER wire x.CorrelationId, x.CausationId into x.Meta.["$correlationId"] and .["$causationId"]
// https://eventstore.org/docs/server/metadata-and-reserved-names/index.html#event-metadata
EventData(Guid.NewGuid(), x.EventType, isJson = true, data = x.Data, metadata = x.Meta)
EventData(x.EventId, x.EventType, isJson = true, data = x.Data, metadata = x.Meta)

type Stream = { name : string }
type Position = { streamVersion : int64; compactionEventNumber : int64 option; batchCapacityLimit : int option }
Expand Down
4 changes: 2 additions & 2 deletions src/Equinox.MemoryStore/Equinox.MemoryStore.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<PackageReference Include="FSharp.Core" Version="3.1.2.5" Condition=" '$(TargetFramework)' == 'net461' " />
<PackageReference Include="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />

<!-- only uses FsCodec.Box, which happens to be houses in the NewtonsoftJson package-->
<PackageReference Include="FsCodec.NewtonsoftJson" Version="2.0.0-rc3" />
<!-- only uses FsCodec.Box, which happens to be housed in the NewtonsoftJson package-->
<PackageReference Include="FsCodec.NewtonsoftJson" Version="2.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Equinox.MemoryStore/MemoryStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type Category<'event, 'state, 'context, 'Format>(store : VolatileStore<'Format>,
| Some (Decode events) -> return Token.ofEventArray streamName fold initial events }
member __.TrySync(_log, Token.Unpack token, state, events : 'event list, context : 'context option) = async {
let inline map i (e : FsCodec.IEventData<'Format>) =
FsCodec.Core.TimelineEvent.Create(int64 i,e.EventType,e.Data,e.Meta,e.CorrelationId,e.CausationId,e.Timestamp)
FsCodec.Core.TimelineEvent.Create(int64 i, e.EventType, e.Data, e.Meta, e.EventId, e.CorrelationId, e.CausationId, e.Timestamp)
let encoded : FsCodec.ITimelineEvent<_>[] = events |> Seq.mapi (fun i e -> map (token.streamVersion+i) (codec.Encode(context,e))) |> Array.ofSeq
let trySyncValue currentValue =
if Array.length currentValue <> token.streamVersion + 1 then ConcurrentDictionarySyncResult.Conflict (token.streamVersion)
Expand Down
2 changes: 1 addition & 1 deletion src/Equinox.SqlStreamStore/Equinox.SqlStreamStore.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="FSharp.Core" Version="3.1.2.5" Condition=" '$(TargetFramework)' == 'net461' " />
<PackageReference Include="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />

<PackageReference Include="FsCodec" Version="2.0.0-rc3" />
<PackageReference Include="FsCodec" Version="2.0.0" />
<PackageReference Include="FSharp.Control.AsyncSeq" Version="2.0.21" />
<PackageReference Include="SqlStreamStore" Version="1.2.0-beta.8" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Equinox.SqlStreamStore/SqlStreamStore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ module UnionEncoderAdapters =
let (Bytes meta) = e.JsonMetadata
// TOCONSIDER wire x.CorrelationId, x.CausationId into x.Meta.["$correlationId"] and .["$causationId"]
// https://eventstore.org/docs/server/metadata-and-reserved-names/index.html#event-metadata
FsCodec.Core.TimelineEvent.Create(int64 e.StreamVersion, e.Type, data, meta, null, null, let ts = e.CreatedUtc in DateTimeOffset ts)
FsCodec.Core.TimelineEvent.Create(int64 e.StreamVersion, e.Type, data, meta, e.MessageId, null, null, let ts = e.CreatedUtc in DateTimeOffset ts)
let eventDataOfEncodedEvent (x : FsCodec.IEventData<byte[]>) =
let str = function null -> null | s -> System.Text.Encoding.UTF8.GetString s
// TOCONSIDER wire x.CorrelationId, x.CausationId into x.Meta.["$correlationId"] and .["$causationId"]
// https://eventstore.org/docs/server/metadata-and-reserved-names/index.html#event-metadata
NewStreamMessage(Guid.NewGuid(), x.EventType, str x.Data, str x.Meta)
NewStreamMessage(x.EventId, x.EventType, str x.Data, str x.Meta)

type Stream = { name: string }
type Position = { streamVersion: int64; compactionEventNumber: int64 option; batchCapacityLimit: int option }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="FsCheck.xUnit" Version="2.14.0" />
<PackageReference Include="FsCodec.NewtonsoftJson" Version="2.0.0-rc3" />
<PackageReference Include="FsCodec.NewtonsoftJson" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
<Reference Include="System.Runtime.Caching" Condition=" '$(TargetFramework)' != 'netstandard2.0'" />
Expand Down

0 comments on commit 66a8e71

Please sign in to comment.