| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package annotation | 5 package annotation |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "strconv" | 9 "strconv" |
| 10 "strings" | 10 "strings" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 // this function will return nil. | 454 // this function will return nil. |
| 455 func (s *State) ResolveStep(ms *milo.Step) *Step { return s.stepLookup[ms] } | 455 func (s *State) ResolveStep(ms *milo.Step) *Step { return s.stepLookup[ms] } |
| 456 | 456 |
| 457 // RootStep returns the root step. | 457 // RootStep returns the root step. |
| 458 func (s *State) RootStep() *Step { | 458 func (s *State) RootStep() *Step { |
| 459 s.initialize() | 459 s.initialize() |
| 460 | 460 |
| 461 return &s.rootStep | 461 return &s.rootStep |
| 462 } | 462 } |
| 463 | 463 |
| 464 // AnnotationStream returns the name of this State's Milo annotation datagram | |
| 465 // stream. | |
| 466 func (s *State) AnnotationStream() types.StreamName { | |
| 467 return s.rootStep.BaseStream("annotations") | |
| 468 } | |
| 469 | |
| 470 // CurrentStep returns the step referenced by the step cursor. | 464 // CurrentStep returns the step referenced by the step cursor. |
| 471 func (s *State) CurrentStep() *Step { | 465 func (s *State) CurrentStep() *Step { |
| 472 s.initialize() | 466 s.initialize() |
| 473 | 467 |
| 474 return s.stepCursor | 468 return s.stepCursor |
| 475 } | 469 } |
| 476 | 470 |
| 477 // SetCurrentStep sets the current step. If the supplied step is nil, the root | 471 // SetCurrentStep sets the current step. If the supplied step is nil, the root |
| 478 // step will be used. | 472 // step will be used. |
| 479 // | 473 // |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 as.StderrStream, updated = as.maybeSetLogDogStream(as.StderrStream, st) | 926 as.StderrStream, updated = as.maybeSetLogDogStream(as.StderrStream, st) |
| 933 return | 927 return |
| 934 } | 928 } |
| 935 | 929 |
| 936 func (as *Step) maybeSetLogDogStream(target *milo.LogdogStream, st *milo.LogdogS
tream) (*milo.LogdogStream, bool) { | 930 func (as *Step) maybeSetLogDogStream(target *milo.LogdogStream, st *milo.LogdogS
tream) (*milo.LogdogStream, bool) { |
| 937 if (target == nil && st == nil) || (target != nil && st != nil && *targe
t == *st) { | 931 if (target == nil && st == nil) || (target != nil && st != nil && *targe
t == *st) { |
| 938 return target, false | 932 return target, false |
| 939 } | 933 } |
| 940 return st, true | 934 return st, true |
| 941 } | 935 } |
| OLD | NEW |