MCPcopy
hub / github.com/crowdsecurity/crowdsec / copyEvent

Function copyEvent

pkg/acquisition/acquisition.go:447–456  ·  view source on GitHub ↗

There's no need for an actual deep copy The event is almost empty, we are mostly interested in allocating new maps for Parsed/Meta/...

(evt pipeline.Event, line string)

Source from the content-addressed store, hash-verified

445// There's no need for an actual deep copy
446// The event is almost empty, we are mostly interested in allocating new maps for Parsed/Meta/...
447func copyEvent(evt pipeline.Event, line string) pipeline.Event {
448 evtCopy := pipeline.MakeEvent(evt.ExpectMode == pipeline.TIMEMACHINE, evt.Type, evt.Process)
449 evtCopy.Line = evt.Line
450 evtCopy.Line.Raw = line
451 evtCopy.Line.Labels = make(map[string]string)
452
453 maps.Copy(evtCopy.Line.Labels, evt.Line.Labels)
454
455 return evtCopy
456}
457
458func transform(
459 transformChan chan pipeline.Event,

Callers 1

transformFunction · 0.85

Calls 1

MakeEventFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…