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

Side by Side Diff: server/internal/logdog/collector/collector.go

Issue 1910923002: LogDog: Add project namespace to service endpoint. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-coordinator-backend
Patch Set: Comments. Created 4 years, 7 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 | « common/logdog/types/streamsecret.go ('k') | server/internal/logdog/collector/collector_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "time" 9 "time"
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return errors.New("failed to marshal log entries ") 224 return errors.New("failed to marshal log entries ")
225 } 225 }
226 } 226 }
227 } 227 }
228 228
229 // Fetch our cached/remote state. This will replace our state object wit h the 229 // Fetch our cached/remote state. This will replace our state object wit h the
230 // fetched state, so any future calls will need to re-set the Secret val ue. 230 // fetched state, so any future calls will need to re-set the Secret val ue.
231 // TODO: Use timeout? 231 // TODO: Use timeout?
232 state, err := c.Coordinator.RegisterStream(ctx, &coordinator.LogStreamSt ate{ 232 state, err := c.Coordinator.RegisterStream(ctx, &coordinator.LogStreamSt ate{
233 Path: h.path, 233 Path: h.path,
234 » » Secret: types.StreamSecret(h.be.Secret), 234 » » Secret: types.PrefixSecret(h.be.Secret),
235 ProtoVersion: h.md.ProtoVersion, 235 ProtoVersion: h.md.ProtoVersion,
236 }, h.be.Desc) 236 }, h.be.Desc)
237 if err != nil { 237 if err != nil {
238 log.WithError(err).Errorf(ctx, "Failed to get/register current s tream state.") 238 log.WithError(err).Errorf(ctx, "Failed to get/register current s tream state.")
239 return err 239 return err
240 } 240 }
241 241
242 // Does the log stream's secret match the expected secret? 242 // Does the log stream's secret match the expected secret?
243 if !bytes.Equal(h.be.Secret, []byte(state.Secret)) { 243 if !bytes.Equal(h.be.Secret, []byte(state.Secret)) {
244 log.Errorf(log.SetFields(ctx, log.Fields{ 244 log.Errorf(log.SetFields(ctx, log.Fields{
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 for _, e := range merr { 337 for _, e := range merr {
338 if hasTransientError(e) { 338 if hasTransientError(e) {
339 return true 339 return true
340 } 340 }
341 } 341 }
342 return false 342 return false
343 } 343 }
344 344
345 return errors.IsTransient(err) 345 return errors.IsTransient(err)
346 } 346 }
OLDNEW
« no previous file with comments | « common/logdog/types/streamsecret.go ('k') | server/internal/logdog/collector/collector_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698