Skip to content

Commit

Permalink
Distinguish between Added and Removed (#133)
Browse files Browse the repository at this point in the history
* Removed Upserted and distinguished between Added and Removed

* Removed helper
  • Loading branch information
masesdevelopers authored Oct 22, 2023
1 parent 04ab116 commit fc08423
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions src/net/KEFCore/Storage/EntityTypeChanged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ public enum ChangeKindType
/// The <see cref="Key"/> was removed
/// </summary>
Removed = 4,
/// <summary>
/// The <see cref="Key"/> was added or updated
/// </summary>
Upserted = Added | Updated,
}

internal EntityTypeChanged(IEntityType entityType, ChangeKindType changeKind, object key)
Expand Down Expand Up @@ -78,8 +74,4 @@ internal EntityTypeChanged(IEntityType entityType, ChangeKindType changeKind, ob
/// Helper to understand if the <see cref="Key"/> was removed
/// </summary>
public bool KeyRemoved => ChangeKind.HasFlag(ChangeKindType.Removed);
/// <summary>
/// Helper to understand if the <see cref="Key"/> was added or updated
/// </summary>
public bool KeyUpserted => ChangeKind.HasFlag(ChangeKindType.Added) | ChangeKind.HasFlag(ChangeKindType.Updated);
}
2 changes: 1 addition & 1 deletion src/net/KEFCore/Storage/Internal/EntityTypeProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ private void KafkaCompactedReplicator_OnRemoteUpdate(IKNetCompactedReplicator<TK
{
Task.Factory.StartNew(() =>
{
_onChangeEvent?.Invoke(new EntityTypeChanged(_entityType, EntityTypeChanged.ChangeKindType.Upserted, arg2.Key));
_onChangeEvent?.Invoke(new EntityTypeChanged(_entityType, arg1.ContainsKey(arg2.Key) ? EntityTypeChanged.ChangeKindType.Updated : EntityTypeChanged.ChangeKindType.Added, arg2.Key));
});
}

Expand Down

0 comments on commit fc08423

Please sign in to comment.