Files
threshold/internal/bsr/types.go
T
Timothy Messier 78ea1a9f3a refact(bsr): Use JSON for session meta and summary data
The session metadata is provided all at once when a new bsr is opened.
While the session recording metadata records metadata about a recording
while the recording is happening, notably it records each time a new
connection occurs.

The nested structure of the session metadata does not lend itself to the
append-only syntax of the recording meta file. In addition we do not
want to mix different kinds of metadata together. Thus the session
metadata is now written to a separate file in the BSR, and is written as
JSON which better handles the nested structure and allows for simpler
encoding/decoding.

Similarly the summary files are intended to be written to as containers
close and have been switched to JSON.
2023-05-31 12:18:23 +00:00

43 lines
1.2 KiB
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package bsr
import "time"
type (
// SessionSummary encapsulates data for a session, including its session id, connection count,
// and start/end time using a monotonic clock
SessionSummary struct {
Id string
ConnectionCount uint64
StartTime time.Time
EndTime time.Time
Errors error
}
// ConnectionSummary encapsulates data for a connection, including its connection id, channel count,
// start/end time using a monotonic clock, and the aggregate bytes up/ down of its channels
ConnectionSummary struct {
Id string
ChannelCount uint64
StartTime time.Time
EndTime time.Time
BytesUp uint64
BytesDown uint64
Errors error
}
// ChannelSummary encapsulates data for a channel, including its id, channel type,
// start/end time using a monotonic clock, and the bytes up/ down seen on this channel
ChannelSummary struct {
Id string
ConnectionRecordingId string
StartTime time.Time
EndTime time.Time
BytesUp uint64
BytesDown uint64
ChannelType string
}
)