Skip to content

Commit

Permalink
chore: implement FindingDataStruct interface
Browse files Browse the repository at this point in the history
Implement the detect.FindingDataStruct interface for the ProcessLineage
data source.
  • Loading branch information
geyslan committed Aug 19, 2024
1 parent a325d64 commit 6b3c049
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions types/datasource/proctree.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package datasource

import (
"strconv"
"time"
)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6b3c049

Please sign in to comment.