| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package collector | 5 package collector |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "errors" | 9 "errors" |
| 10 "fmt" | 10 "fmt" |
| 11 "sort" | 11 "sort" |
| 12 "strings" | 12 "strings" |
| 13 "sync" | 13 "sync" |
| 14 "time" | 14 "time" |
| 15 | 15 |
| 16 "github.com/golang/protobuf/proto" | 16 "github.com/golang/protobuf/proto" |
| 17 "github.com/luci/luci-go/common/clock" | 17 "github.com/luci/luci-go/common/clock" |
| 18 "github.com/luci/luci-go/common/logdog/butlerproto" | 18 "github.com/luci/luci-go/common/logdog/butlerproto" |
| 19 "github.com/luci/luci-go/common/logdog/types" | 19 "github.com/luci/luci-go/common/logdog/types" |
| 20 "github.com/luci/luci-go/common/proto/google" | 20 "github.com/luci/luci-go/common/proto/google" |
| 21 "github.com/luci/luci-go/common/proto/logdog/logpb" | 21 "github.com/luci/luci-go/common/proto/logdog/logpb" |
| 22 cc "github.com/luci/luci-go/server/internal/logdog/collector/coordinator
" | 22 cc "github.com/luci/luci-go/server/internal/logdog/collector/coordinator
" |
| 23 "github.com/luci/luci-go/server/logdog/storage" | 23 "github.com/luci/luci-go/server/logdog/storage" |
| 24 "golang.org/x/net/context" | 24 "golang.org/x/net/context" |
| 25 ) | 25 ) |
| 26 | 26 |
| 27 var testSecret = bytes.Repeat([]byte{0x55}, types.StreamSecretLength) | 27 var testSecret = bytes.Repeat([]byte{0x55}, types.PrefixSecretLength) |
| 28 | 28 |
| 29 // testCoordinator is an implementation of Coordinator that can be used for | 29 // testCoordinator is an implementation of Coordinator that can be used for |
| 30 // testing. | 30 // testing. |
| 31 type testCoordinator struct { | 31 type testCoordinator struct { |
| 32 sync.Mutex | 32 sync.Mutex |
| 33 | 33 |
| 34 // errC is a channel that error status will be read from if not nil. | 34 // errC is a channel that error status will be read from if not nil. |
| 35 errC chan error | 35 errC chan error |
| 36 | 36 |
| 37 // state is the latest tracked stream state. | 37 // state is the latest tracked stream state. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 extra[i] = fmt.Sprintf("%d", idx) | 349 extra[i] = fmt.Sprintf("%d", idx) |
| 350 } | 350 } |
| 351 failed = append(failed, fmt.Sprintf("extra{%s}", strings.Join(ex
tra, ","))) | 351 failed = append(failed, fmt.Sprintf("extra{%s}", strings.Join(ex
tra, ","))) |
| 352 } | 352 } |
| 353 | 353 |
| 354 if len(failed) > 0 { | 354 if len(failed) > 0 { |
| 355 return strings.Join(failed, ", ") | 355 return strings.Join(failed, ", ") |
| 356 } | 356 } |
| 357 return "" | 357 return "" |
| 358 } | 358 } |
| OLD | NEW |