Skip to content

Commit

Permalink
Removed IKafkaSerdesFactory and other code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
masesdevelopers committed Oct 4, 2023
1 parent fe57106 commit 73f1719
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 301 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
using MASES.EntityFrameworkCore.KNet.Infrastructure.Internal;
using MASES.EntityFrameworkCore.KNet.Metadata.Conventions;
using MASES.EntityFrameworkCore.KNet.Query.Internal;
using MASES.EntityFrameworkCore.KNet.Serdes.Internal;
using MASES.EntityFrameworkCore.KNet.Storage.Internal;
using MASES.EntityFrameworkCore.KNet.ValueGeneration.Internal;
using System.ComponentModel;
Expand Down Expand Up @@ -72,8 +71,7 @@ public static IServiceCollection AddEntityFrameworkKafkaDatabase(this IServiceCo
.TryAddSingleton<IKafkaSingletonOptions, KafkaSingletonOptions>()
.TryAddSingleton<IKafkaClusterCache, KafkaClusterCache>()
.TryAddSingleton<IKafkaTableFactory, KafkaTableFactory>()
.TryAddScoped<IKafkaDatabase, KafkaDatabase>()
.TryAddScoped<IKafkaSerdesFactory, KafkaSerdesFactory>());
.TryAddScoped<IKafkaDatabase, KafkaDatabase>());

builder.TryAddCoreServices();

Expand Down
6 changes: 2 additions & 4 deletions src/net/KEFCore/Query/Internal/KafkaQueryContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,15 @@ public virtual IEnumerable<ValueBuffer> GetValueBuffers(IEntityType entityType)
{
if (!_valueBuffersCache.TryGetValue(entityType, out var valueBuffers))
{
valueBuffers = Cluster.GetData(entityType);
valueBuffers = Cluster.GetValueBuffers(entityType);

_valueBuffersCache[entityType] = valueBuffers;
}

return valueBuffers;
}

public KafkaQueryContext(
QueryContextDependencies dependencies,
IKafkaCluster cluster)
public KafkaQueryContext(QueryContextDependencies dependencies, IKafkaCluster cluster)
: base(dependencies)
{
Cluster = cluster;
Expand Down
43 changes: 0 additions & 43 deletions src/net/KEFCore/Serdes/Internal/IKafkaSerdesEntityType.cs

This file was deleted.

31 changes: 0 additions & 31 deletions src/net/KEFCore/Serdes/Internal/IKafkaSerdesFactory.cs

This file was deleted.

125 changes: 0 additions & 125 deletions src/net/KEFCore/Serdes/Internal/KafkaSerdesEntityType.cs

This file was deleted.

54 changes: 0 additions & 54 deletions src/net/KEFCore/Serdes/Internal/KafkaSerdesFactory.cs

This file was deleted.

25 changes: 6 additions & 19 deletions src/net/KEFCore/Storage/Internal/IKafkaCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,25 @@
*/

using MASES.EntityFrameworkCore.KNet.Infrastructure.Internal;
using MASES.EntityFrameworkCore.KNet.Serdes.Internal;
using MASES.EntityFrameworkCore.KNet.ValueGeneration.Internal;

namespace MASES.EntityFrameworkCore.KNet.Storage.Internal;

public interface IKafkaCluster :IDisposable
public interface IKafkaCluster : IDisposable
{
bool EnsureDeleted(
IUpdateAdapterFactory updateAdapterFactory,
IModel designModel,
IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger);
bool EnsureDeleted(IUpdateAdapterFactory updateAdapterFactory, IModel designModel, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger);

bool EnsureCreated(
IUpdateAdapterFactory updateAdapterFactory,
IModel designModel,
IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger);
bool EnsureCreated(IUpdateAdapterFactory updateAdapterFactory, IModel designModel, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger);

bool EnsureConnected(
IModel designModel,
IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger);
bool EnsureConnected(IModel designModel, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger);

string CreateTable(IEntityType entityType);

IKafkaSerdesFactory SerdesFactory { get; }

IEnumerable<ValueBuffer> GetData(IEntityType entityType);
IEnumerable<ValueBuffer> GetValueBuffers(IEntityType entityType);

KafkaIntegerValueGenerator<TProperty> GetIntegerValueGenerator<TProperty>(IProperty property);

int ExecuteTransaction(
IList<IUpdateEntry> entries,
IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger);
int ExecuteTransaction(IList<IUpdateEntry> entries, IDiagnosticsLogger<DbLoggerCategory.Update> updateLogger);

KafkaOptionsExtension Options { get; }
}
2 changes: 0 additions & 2 deletions src/net/KEFCore/Storage/Internal/IKafkaRowBag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#nullable enable

using MASES.EntityFrameworkCore.KNet.Serdes.Internal;

namespace MASES.EntityFrameworkCore.KNet.Storage.Internal;

public interface IKafkaRowBag
Expand Down
10 changes: 2 additions & 8 deletions src/net/KEFCore/Storage/Internal/IKafkaTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@

namespace MASES.EntityFrameworkCore.KNet.Storage.Internal;

public interface IKafkaTable : IDisposable
public interface IKafkaTable : IEntityTypeProducer
{
IReadOnlyList<object?[]> SnapshotRows();

IEnumerable<ValueBuffer> ValueBuffers { get; }

IEnumerable<object?[]> Rows { get; }

IKafkaRowBag Create(IUpdateEntry entry);
Expand All @@ -38,11 +36,7 @@ public interface IKafkaTable : IDisposable

IKafkaRowBag Update(IUpdateEntry entry);

IEnumerable<Future<RecordMetadata>> Commit(IEnumerable<IKafkaRowBag> records);

KafkaIntegerValueGenerator<TProperty> GetIntegerValueGenerator<TProperty>(
IProperty property,
IReadOnlyList<IKafkaTable> tables);
KafkaIntegerValueGenerator<TProperty> GetIntegerValueGenerator<TProperty>(IProperty property, IReadOnlyList<IKafkaTable> tables);

void BumpValueGenerators(object?[] row);

Expand Down
Loading

0 comments on commit 73f1719

Please sign in to comment.