mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-07 03:48:17 +02:00
reconciler: allow custom comparison function (#4727)
reconciler: allow custom comparison function (#4726) Co-authored-by: Denis Mishin <dmishin@pomerium.com>
This commit is contained in:
parent
da9b14db44
commit
c9583c828c
4 changed files with 19 additions and 9 deletions
|
@ -9,13 +9,13 @@ import (
|
|||
|
||||
// GetChangeSet returns list of changes between the current and target record sets,
|
||||
// that may be applied to the databroker to bring it to the target state.
|
||||
func GetChangeSet(current, target RecordSetBundle) []*Record {
|
||||
func GetChangeSet(current, target RecordSetBundle, cmpFn RecordCompareFn) []*Record {
|
||||
cs := &changeSet{now: timestamppb.Now()}
|
||||
|
||||
for _, rec := range current.GetRemoved(target).Flatten() {
|
||||
cs.Remove(rec.GetType(), rec.GetId())
|
||||
}
|
||||
for _, rec := range current.GetModified(target).Flatten() {
|
||||
for _, rec := range current.GetModified(target, cmpFn).Flatten() {
|
||||
cs.Upsert(rec)
|
||||
}
|
||||
for _, rec := range current.GetAdded(target).Flatten() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue