From 46aaf9b415f6429df091837a48c28ca33cd3f948 Mon Sep 17 00:00:00 2001
From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com>
Date: Sun, 22 Oct 2023 03:23:29 +0200
Subject: [PATCH] Reverted #133
---
src/net/KEFCore/Storage/EntityTypeChanged.cs | 8 ++++++++
src/net/KEFCore/Storage/Internal/EntityTypeProducer.cs | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/net/KEFCore/Storage/EntityTypeChanged.cs b/src/net/KEFCore/Storage/EntityTypeChanged.cs
index f2f6def8..03f4068c 100644
--- a/src/net/KEFCore/Storage/EntityTypeChanged.cs
+++ b/src/net/KEFCore/Storage/EntityTypeChanged.cs
@@ -42,6 +42,10 @@ public enum ChangeKindType
/// The was removed
///
Removed = 4,
+ ///
+ /// The was added or updated
+ ///
+ Upserted = Added | Updated,
}
internal EntityTypeChanged(IEntityType entityType, ChangeKindType changeKind, object key)
@@ -74,4 +78,8 @@ internal EntityTypeChanged(IEntityType entityType, ChangeKindType changeKind, ob
/// Helper to understand if the was removed
///
public bool KeyRemoved => ChangeKind.HasFlag(ChangeKindType.Removed);
+ ///
+ /// Helper to understand if the was added or updated
+ ///
+ public bool KeyUpserted => ChangeKind.HasFlag(ChangeKindType.Added) | ChangeKind.HasFlag(ChangeKindType.Updated);
}
diff --git a/src/net/KEFCore/Storage/Internal/EntityTypeProducer.cs b/src/net/KEFCore/Storage/Internal/EntityTypeProducer.cs
index cc497435..7bef6792 100644
--- a/src/net/KEFCore/Storage/Internal/EntityTypeProducer.cs
+++ b/src/net/KEFCore/Storage/Internal/EntityTypeProducer.cs
@@ -300,7 +300,7 @@ private void KafkaCompactedReplicator_OnRemoteUpdate(IKNetCompactedReplicator
{
- _onChangeEvent?.Invoke(new EntityTypeChanged(_entityType, arg1.ContainsKey(arg2.Key) ? EntityTypeChanged.ChangeKindType.Updated : EntityTypeChanged.ChangeKindType.Added, arg2.Key));
+ _onChangeEvent?.Invoke(new EntityTypeChanged(_entityType, EntityTypeChanged.ChangeKindType.Upserted, arg2.Key));
});
}