feat(database): add CRUD operations for parsed sessions and update session name functionality

This commit is contained in:
kever
2026-02-16 00:39:24 +08:00
parent 41814a2bc8
commit f0a26e31f9
18 changed files with 1119 additions and 1573 deletions

View File

@@ -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),
}
}