MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / NewFromCapture

Function NewFromCapture

pkg/event/event.go:237–246  ·  view source on GitHub ↗

NewFromCapture recovers the event instance from the capture byte buffer.

(buf []byte, ver capver.Version)

Source from the content-addressed store, hash-verified

235
236// NewFromCapture recovers the event instance from the capture byte buffer.
237func NewFromCapture(buf []byte, ver capver.Version) (*Event, error) {
238 e := &Event{
239 Params: make(Params),
240 Metadata: make(map[MetadataKey]any),
241 }
242 if err := e.UnmarshalRaw(buf, ver); err != nil {
243 return nil, err
244 }
245 return e, nil
246}
247
248// AddMeta appends a key/value pair to event's metadata.
249func (e *Event) AddMeta(k MetadataKey, v any) {

Callers 4

ReadMethod · 0.92
TestMarshallerFunction · 0.70
TestUnmarshalHugeHandlesFunction · 0.70
BenchmarkUnmarshalFunction · 0.70

Calls 1

UnmarshalRawMethod · 0.95

Tested by 3

TestMarshallerFunction · 0.56
TestUnmarshalHugeHandlesFunction · 0.56
BenchmarkUnmarshalFunction · 0.56