Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 9 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@
IEventStore.DistributesAgentsPerTenant into BuildDistributor (ProjectionCoordinator).
Also DaemonMode.ExternallyManaged (jasperfx#490, wolverine#3290 — external hosts run
projections; the store hosts no coordination and must not warn). -->
<PackageVersion Include="JasperFx" Version="2.23.0" />
<PackageVersion Include="JasperFx.Events" Version="2.23.0" />
<PackageVersion Include="JasperFx.Events.SourceGenerator" Version="2.23.0">
<PackageVersion Include="JasperFx" Version="2.24.0" />
<PackageVersion Include="JasperFx.Events" Version="2.24.0" />
<PackageVersion Include="JasperFx.Events.SourceGenerator" Version="2.24.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="JasperFx.SourceGenerator" Version="2.23.0" />
<PackageVersion Include="JasperFx.SourceGenerator" Version="2.24.0" />
<PackageVersion Include="Jil" Version="3.0.0-alpha2" />
<PackageVersion Include="Lamar" Version="7.1.1" />
<PackageVersion Include="Lamar.Microsoft.DependencyInjection" Version="15.0.0" />
Expand Down Expand Up @@ -173,8 +173,11 @@
<!-- 9.14.0 (weasel#339): dialect-neutral grouped-parameter seam (Weasel.Core.IGroupedParameterBuilder
+ ICommandBuilder.CreateGroupedParameterBuilder/AppendParameter(object)) + StorageColumnType.Binary,
so the closed-shape EVENT binders + per-event ops drop their direct Npgsql reference (#4821 event E1). -->
<PackageVersion Include="Weasel.Postgresql" Version="9.14.0" />
<PackageVersion Include="Weasel.Storage" Version="9.14.0" />
<!-- 9.15.0 (weasel#341): closed-shape EVENT descriptor core moved into Weasel.Storage — the 3
descriptors, IEventMetadataBinder + 5 metadata binders, IEventStoreSqlDialect — so Marten and
Polecat share them (#4821 event E2). -->
<PackageVersion Include="Weasel.Postgresql" Version="9.15.0" />
<PackageVersion Include="Weasel.Storage" Version="9.15.0" />
<PackageVersion Include="WolverineFx.Marten" Version="4.2.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
Expand Down
38 changes: 28 additions & 10 deletions src/Marten/EventStorage/Dialects/PostgresEventStoreDialect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq;
using JasperFx.Core;
using JasperFx.Events;
using Marten.EventStorage.Metadata;
using Marten.EventStorage.Quick;
using Marten.EventStorage.QuickWithServerTimestamps;
using Marten.Internal.Storage;
Expand Down Expand Up @@ -40,8 +39,12 @@ namespace Marten.EventStorage.Dialects;
/// </remarks>
internal sealed class PostgresEventStoreDialect: IEventStoreSqlDialect
{
public RichEventStorageDescriptor BuildRichDescriptor(EventGraph graph, ISerializer serializer)
public RichEventStorageDescriptor BuildRichDescriptor(EventRegistry registry, IStorageSerializer storageSerializer)
{
// The neutral IEventStoreSqlDialect contract (Weasel.Storage) types these as
// EventRegistry / IStorageSerializer; Marten's concrete types derive from both.
var graph = (EventGraph)registry;
var serializer = (ISerializer)storageSerializer;
var (orderedColumns, sqlPrefix) = BuildAppendEventFullColumnsAndPrefix(graph);
var storageDialect = ResolveStorageDialect(graph);
var metadataBinders = SelectRichMetadataBinders(orderedColumns, storageDialect);
Expand Down Expand Up @@ -86,8 +89,8 @@ public RichEventStorageDescriptor BuildRichDescriptor(EventGraph graph, ISeriali
Dialect = storageDialect,
AppendEventQuickWithVersionSqlSuffix = quickWithVersionSuffix,
MetadataBindersWithoutSequence = metadataBindersWithoutSequence,
ConfigureInsertStreamCommand = BuildInsertStreamCommandConfigurer(graph, isConjoined, isGuid),
ConfigureUpdateStreamVersionCommand = BuildUpdateStreamVersionCommandConfigurer(graph, isConjoined, isGuid),
ConfigureInsertStreamCommand = Adapt(BuildInsertStreamCommandConfigurer(graph, isConjoined, isGuid)),
ConfigureUpdateStreamVersionCommand = Adapt(BuildUpdateStreamVersionCommandConfigurer(graph, isConjoined, isGuid)),
};
}

Expand All @@ -108,6 +111,17 @@ public RichEventStorageDescriptor BuildRichDescriptor(EventGraph graph, ISeriali
/// (<c>timestamp</c> and <c>created</c> are <c>Writes=false</c>;
/// <c>is_archived</c> isn't an <c>IStreamTableColumn</c>.)
/// </remarks>
/// <summary>
/// Adapts a Postgres-typed stream-command configurer to the neutral
/// <c>Action&lt;Weasel.Core.ICommandBuilder, StreamAction&gt;</c> slot the moved
/// descriptors (Weasel.Storage) now expose. The runtime command builder is
/// always the Postgres one, so the cast back inside the adapter is safe —
/// this is the same dialect-boundary downcast the operations do.
/// </summary>
private static Action<Weasel.Core.ICommandBuilder, StreamAction> Adapt(
Action<ICommandBuilder, StreamAction> pgConfigurer)
=> (builder, stream) => pgConfigurer((ICommandBuilder)builder, stream);

private static Action<ICommandBuilder, StreamAction> BuildInsertStreamCommandConfigurer(
EventGraph graph, bool isConjoined, bool isGuid)
{
Expand Down Expand Up @@ -275,8 +289,10 @@ private static Action<ICommandBuilder, StreamAction> BuildUpdateStreamVersionCom
};
}

public QuickEventStorageDescriptor BuildQuickDescriptor(EventGraph graph, ISerializer serializer)
public QuickEventStorageDescriptor BuildQuickDescriptor(EventRegistry registry, IStorageSerializer storageSerializer)
{
var graph = (EventGraph)registry;
var serializer = (ISerializer)storageSerializer;
// #4515 Phase 2: Quick mode now supports binary events too. The
// mt_quick_append_events PG function gained a `bdatas bytea[]`
// parameter that's inserted into mt_events.bdata in parallel with
Expand Down Expand Up @@ -328,8 +344,8 @@ public QuickEventStorageDescriptor BuildQuickDescriptor(EventGraph graph, ISeria
// and what NpgsqlDbType it should be.
UseTenantPartitionedEvents = graph.UseTenantPartitionedEvents,
UseBigIntEvents = graph.EnableBigIntEvents,
ConfigureInsertStreamCommand = BuildInsertStreamCommandConfigurer(graph, isConjoined, isGuid),
ConfigureUpdateStreamVersionCommand = BuildUpdateStreamVersionCommandConfigurer(graph, isConjoined, isGuid),
ConfigureInsertStreamCommand = Adapt(BuildInsertStreamCommandConfigurer(graph, isConjoined, isGuid)),
ConfigureUpdateStreamVersionCommand = Adapt(BuildUpdateStreamVersionCommandConfigurer(graph, isConjoined, isGuid)),
AppendEventSqlPrefix = appendEventSqlPrefix,
AppendEventSqlSuffix = quickWithVersionSuffix,
MetadataBinders = quickMetadataBinders,
Expand All @@ -344,8 +360,10 @@ public QuickEventStorageDescriptor BuildQuickDescriptor(EventGraph graph, ISeria
}

public QuickWithServerTimestampsEventStorageDescriptor BuildQuickWithServerTimestampsDescriptor(
EventGraph graph, ISerializer serializer)
EventRegistry registry, IStorageSerializer storageSerializer)
{
var graph = (EventGraph)registry;
var serializer = (ISerializer)storageSerializer;
// #4515 Phase 2: Quick-with-server-timestamps supports binary events
// too — see BuildQuickDescriptor for the dispatch shape.

Expand Down Expand Up @@ -392,8 +410,8 @@ public QuickWithServerTimestampsEventStorageDescriptor BuildQuickWithServerTimes
// and what NpgsqlDbType it should be.
UseTenantPartitionedEvents = graph.UseTenantPartitionedEvents,
UseBigIntEvents = graph.EnableBigIntEvents,
ConfigureInsertStreamCommand = BuildInsertStreamCommandConfigurer(graph, isConjoined, isGuid),
ConfigureUpdateStreamVersionCommand = BuildUpdateStreamVersionCommandConfigurer(graph, isConjoined, isGuid),
ConfigureInsertStreamCommand = Adapt(BuildInsertStreamCommandConfigurer(graph, isConjoined, isGuid)),
ConfigureUpdateStreamVersionCommand = Adapt(BuildUpdateStreamVersionCommandConfigurer(graph, isConjoined, isGuid)),
AppendEventSqlPrefix = appendEventSqlPrefix,
AppendEventSqlSuffix = quickWithVersionSuffix,
MetadataBinders = quickMetadataBinders,
Expand Down
83 changes: 0 additions & 83 deletions src/Marten/EventStorage/IEventMetadataBinder.cs

This file was deleted.

36 changes: 0 additions & 36 deletions src/Marten/EventStorage/IEventStoreSqlDialect.cs

This file was deleted.

38 changes: 0 additions & 38 deletions src/Marten/EventStorage/Metadata/CausationIdColumnBinder.cs

This file was deleted.

30 changes: 0 additions & 30 deletions src/Marten/EventStorage/Metadata/CorrelationIdColumnBinder.cs

This file was deleted.

55 changes: 0 additions & 55 deletions src/Marten/EventStorage/Metadata/HeadersColumnBinder.cs

This file was deleted.

Loading
Loading