github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/internal/trace/v2/testtrace/validation.go (about) 1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package testtrace 6 7 // Validator is a type used for validating a stream of trace.Events. 8 type Validator struct { 9 lastTs trace.Time 10 gs map[trace.GoID]*goState 11 ps map[trace.ProcID]*procState 12 ms map[trace.ThreadID]*schedContext 13 ranges map[trace.ResourceID][]string 14 tasks map[trace.TaskID]string 15 seenSync bool 16 Go121 bool 17 } 18 19 // NewValidator creates a new Validator. 20 func NewValidator() *Validator 21 22 // Event validates ev as the next event in a stream of trace.Events. 23 // 24 // Returns an error if validation fails. 25 func (v *Validator) Event(ev trace.Event) error