http3: add the qlog event schema to trace header (#5383)

This commit is contained in:
Marten Seemann
2025-10-15 12:02:05 +08:00
committed by GitHub
parent 378d867241
commit 5e5100b40c
15 changed files with 129 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"log"
"slices"
"sync"
"time"
@@ -18,6 +19,9 @@ type Trace interface {
// AddProducer creates a new Recorder for this trace.
// Each Recorder can record events independently.
AddProducer() Recorder
// SupportsSchemas returns true if the trace supports the given schema.
SupportsSchemas(schema string) bool
}
// Recorder is used to record events to a qlog trace.
@@ -67,6 +71,8 @@ type FileSeq struct {
mx sync.Mutex
producers int
closed bool
eventSchemas []string
}
var _ Trace = &FileSeq{}
@@ -112,6 +118,10 @@ func newFileSeq(w io.WriteCloser, pers string, odcid *ConnectionID, eventSchemas
}
}
func (t *FileSeq) SupportsSchemas(schema string) bool {
return slices.Contains(t.eventSchemas, schema)
}
func (t *FileSeq) AddProducer() Recorder {
t.mx.Lock()
defer t.mx.Unlock()