From 6b3c0496fa2be2ed4f14de56f1dfd89e5e3ff14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geyslan=20Greg=C3=B3rio?= Date: Mon, 19 Aug 2024 17:56:16 -0300 Subject: [PATCH] chore: implement FindingDataStruct interface Implement the detect.FindingDataStruct interface for the ProcessLineage data source. --- types/datasource/proctree.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/datasource/proctree.go b/types/datasource/proctree.go index d034bdcef905..c01cec81211c 100644 --- a/types/datasource/proctree.go +++ b/types/datasource/proctree.go @@ -1,6 +1,7 @@ package datasource import ( + "strconv" "time" ) @@ -60,6 +61,16 @@ type FileInfo struct { // The lineage is only relevant for the container the process resides in. type ProcessLineage []TimeRelevantInfo[ProcessInfo] +// ToMap is the way to implement the detect.FindingDataStruct interface +func (pl ProcessLineage) ToMap() map[string]interface{} { + lmap := make(map[string]interface{}, len(pl)) + for i, ti := range pl { + lmap[strconv.Itoa(i)] = ti + } + + return lmap +} + // ProcKey is a key to the process tree data source, which will result receiving ProcessInfo in the // response for the matching process in the given time. type ProcKey struct {