Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverted #133 #134

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
8 changes: 8 additions & 0 deletions src/net/KEFCore/Storage/EntityTypeChanged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ 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 @@ -74,4 +78,8 @@ 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, arg1.ContainsKey(arg2.Key) ? EntityTypeChanged.ChangeKindType.Updated : EntityTypeChanged.ChangeKindType.Added, arg2.Key));
_onChangeEvent?.Invoke(new EntityTypeChanged(_entityType, EntityTypeChanged.ChangeKindType.Upserted, arg2.Key));
});
}

Expand Down
Loading