in batching/batching.go [279:309]
func (b *Batcher) handleData(entry data.Entry) error {
batch, ok := b.current[entry.SourceType()]
if !ok {
batch = getBatch()
batch.Data = map[types.UID]data.Entry{}
batch.age = time.Now()
}
if entry.UID() == "" {
return errors.New("no UID for entry")
}
if entry.ChangeType() == data.CTDelete {
batch.Map()[entry.UID()] = entry
b.current[entry.SourceType()] = batch
return nil
}
old, ok := batch.Map()[entry.UID()]
if !ok {
batch.Map()[entry.UID()] = entry
b.current[entry.SourceType()] = batch
return nil
}
ots := old.Object().(getMeta).GetCreationTimestamp().Time
nts := entry.Object().(getMeta).GetCreationTimestamp().Time
if nts.After(ots) {
batch.Map()[entry.UID()] = entry
b.current[entry.SourceType()] = batch
}
return nil
}