Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: logdog/client/annotee/link_generator.go

Issue 2719183003: Annotee: Export Coordinator link generator. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | logdog/client/annotee/processor.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package annotee
6
7 import (
8 "github.com/luci/luci-go/logdog/common/types"
9 "github.com/luci/luci-go/logdog/common/viewer"
10 "github.com/luci/luci-go/luci_config/common/cfgtypes"
11 )
12
13 // LinkGenerator generates links for a given log stream.
14 type LinkGenerator interface {
15 // GetLink returns a link for the specified aggregate streams.
nodir 2017/02/28 00:22:38 typo
dnj 2017/02/28 00:24:43 Acknowledged.
16 //
17 // If no link could be generated, GetLink may return an empty string.
18 GetLink(name ...types.StreamName) string
19 }
20
21 // CoordinatorLinkGenerator is a LinkGenerator implementation
22 type CoordinatorLinkGenerator struct {
23 Host string
24 Project cfgtypes.ProjectName
25 Prefix types.StreamName
26 }
27
28 // CanGenerateLinks returns true if g is sufficiently configured to generate
29 // LogDog Coordinator links.
30 func (g *CoordinatorLinkGenerator) CanGenerateLinks() bool {
31 return (g.Host != "" && g.Prefix != "")
32 }
33
34 // GetLink implements LinkGenerator.
35 func (g *CoordinatorLinkGenerator) GetLink(names ...types.StreamName) string {
36 paths := make([]types.StreamPath, len(names))
37 for i, name := range names {
38 paths[i] = g.Prefix.AsPathPrefix(name)
39 }
40 return viewer.GetURL(g.Host, g.Project, paths...)
41 }
OLDNEW
« no previous file with comments | « no previous file | logdog/client/annotee/processor.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698