mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-08 20:38:12 +02:00
reconciler: allow custom comparison function (#4726)
This commit is contained in:
parent
ab7b66691d
commit
cc6592b6fd
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