| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 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 logdog | 5 package logdog |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 | 9 |
| 10 miloProto "github.com/luci/luci-go/common/proto/milo" | 10 miloProto "github.com/luci/luci-go/common/proto/milo" |
| 11 ) | 11 ) |
| 12 | 12 |
| 13 // Streams represents a group of LogDog Streams with a single entry point. | 13 // Streams represents a group of LogDog Streams with a single entry point. |
| 14 // Generally all of the streams are referenced by the entry point. | 14 // Generally all of the streams are referenced by the entry point. |
| 15 type Streams struct { | 15 type Streams struct { |
| 16 // MainStream is a pointer to the primary stream for this group of strea
ms. | 16 // MainStream is a pointer to the primary stream for this group of strea
ms. |
| 17 MainStream *Stream | 17 MainStream *Stream |
| 18 » // Streams is the full list of streams referenced by MainStream, includi
ng | 18 » // Streams is the full map streamName->stream referenced by MainStream. |
| 19 » // MainStream. | 19 » // It includes MainStream. |
| 20 Streams map[string]*Stream | 20 Streams map[string]*Stream |
| 21 } | 21 } |
| 22 | 22 |
| 23 // GetFullPath returns the canonical URL of the logdog stream. | 23 // GetFullPath returns the canonical URL of the logdog stream. |
| 24 func (s *Stream) GetFullPath() string { | 24 func (s *Stream) GetFullPath() string { |
| 25 return fmt.Sprintf("https://%s/%s/+/%s", s.Server, s.Prefix, s.Path) | 25 return fmt.Sprintf("https://%s/%s/+/%s", s.Server, s.Prefix, s.Path) |
| 26 } | 26 } |
| 27 | 27 |
| 28 // Stream represents a single LogDog style stream, which can contain either | 28 // Stream represents a single LogDog style stream, which can contain either |
| 29 // annotations (assumed to be MiloProtos) or text. Other types of annotations a
re | 29 // annotations (assumed to be MiloProtos) or text. Other types of annotations a
re |
| 30 // not supported. | 30 // not supported. |
| 31 type Stream struct { | 31 type Stream struct { |
| 32 // Server is the LogDog server this stream originated from. | 32 // Server is the LogDog server this stream originated from. |
| 33 Server string | 33 Server string |
| 34 // Prefix is the LogDog prefix for the Stream. | 34 // Prefix is the LogDog prefix for the Stream. |
| 35 Prefix string | 35 Prefix string |
| 36 // Path is the final part of the LogDog path of the Stream. | 36 // Path is the final part of the LogDog path of the Stream. |
| 37 Path string | 37 Path string |
| 38 // IsDatagram is true if this is a MiloProto. False implies that this is
a text log. | 38 // IsDatagram is true if this is a MiloProto. False implies that this is
a text log. |
| 39 IsDatagram bool | 39 IsDatagram bool |
| 40 // Data is the miloProto.Step of the Stream, if IsDatagram is true. Oth
erwise | 40 // Data is the miloProto.Step of the Stream, if IsDatagram is true. Oth
erwise |
| 41 // this is nil. | 41 // this is nil. |
| 42 Data *miloProto.Step | 42 Data *miloProto.Step |
| 43 // Text is the text of the Stream, if IsDatagram is false. Otherwise | 43 // Text is the text of the Stream, if IsDatagram is false. Otherwise |
| 44 // this is an empty string. | 44 // this is an empty string. |
| 45 Text string | 45 Text string |
| 46 } | 46 } |
| OLD | NEW |