feat(database): add CRUD operations for parsed sessions and update session name functionality
This commit is contained in:
@@ -9,6 +9,13 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
type ProcessorStats struct {
|
||||
AckGroups int
|
||||
UniquePayloads int
|
||||
RawSegmentCount int
|
||||
FinalBufferSize int
|
||||
}
|
||||
|
||||
type TCPProcessor struct {
|
||||
mutex sync.RWMutex
|
||||
ackData map[uint32][]*model.TCPData
|
||||
@@ -94,3 +101,20 @@ func (tp *TCPProcessor) Clear() {
|
||||
tp.finalBuffer = make([]string, 0)
|
||||
tp.loads = make(map[string]bool)
|
||||
}
|
||||
|
||||
func (tp *TCPProcessor) Stats() ProcessorStats {
|
||||
tp.mutex.RLock()
|
||||
defer tp.mutex.RUnlock()
|
||||
|
||||
rawSegmentCount := 0
|
||||
for _, dataList := range tp.ackData {
|
||||
rawSegmentCount += len(dataList)
|
||||
}
|
||||
|
||||
return ProcessorStats{
|
||||
AckGroups: len(tp.ackData),
|
||||
UniquePayloads: len(tp.loads),
|
||||
RawSegmentCount: rawSegmentCount,
|
||||
FinalBufferSize: len(tp.finalBuffer),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user