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

Side by Side Diff: appengine/logdog/coordinator/logStream.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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 coordinator 5 package coordinator
6 6
7 import ( 7 import (
8 "crypto/sha256" 8 "crypto/sha256"
9 "encoding/hex" 9 "encoding/hex"
10 "errors" 10 "errors"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 return fmt.Errorf("hash IDs don't match (%q != %q)", hid , s.HashID) 349 return fmt.Errorf("hash IDs don't match (%q != %q)", hid , s.HashID)
350 } 350 }
351 } 351 }
352 352
353 if err := types.StreamName(s.Prefix).Validate(); err != nil { 353 if err := types.StreamName(s.Prefix).Validate(); err != nil {
354 return fmt.Errorf("invalid prefix: %s", err) 354 return fmt.Errorf("invalid prefix: %s", err)
355 } 355 }
356 if err := types.StreamName(s.Name).Validate(); err != nil { 356 if err := types.StreamName(s.Name).Validate(); err != nil {
357 return fmt.Errorf("invalid name: %s", err) 357 return fmt.Errorf("invalid name: %s", err)
358 } 358 }
359 » if len(s.Secret) != types.StreamSecretLength { 359 » if err := types.PrefixSecret(s.Secret).Validate(); err != nil {
360 » » return fmt.Errorf("invalid secret length (%d != %d)", len(s.Secr et), types.StreamSecretLength) 360 » » return fmt.Errorf("invalid prefix secret: %s", err)
361 } 361 }
362 if s.ContentType == "" { 362 if s.ContentType == "" {
363 return errors.New("empty content type") 363 return errors.New("empty content type")
364 } 364 }
365 if s.Created.IsZero() { 365 if s.Created.IsZero() {
366 return errors.New("created time is not set") 366 return errors.New("created time is not set")
367 } 367 }
368 368
369 if s.Terminated() && s.TerminatedTime.IsZero() { 369 if s.Terminated() && s.TerminatedTime.IsZero() {
370 return errors.New("log stream is terminated, but missing termina ted time") 370 return errors.New("log stream is terminated, but missing termina ted time")
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 // were created before the supplied time. 647 // were created before the supplied time.
648 func AddOlderFilter(q *ds.Query, t time.Time) *ds.Query { 648 func AddOlderFilter(q *ds.Query, t time.Time) *ds.Query {
649 return q.Lt("Created", t.UTC()).Order("-Created") 649 return q.Lt("Created", t.UTC()).Order("-Created")
650 } 650 }
651 651
652 // AddNewerFilter adds a filter to queries that restricts them to results that 652 // AddNewerFilter adds a filter to queries that restricts them to results that
653 // were created after the supplied time. 653 // were created after the supplied time.
654 func AddNewerFilter(q *ds.Query, t time.Time) *ds.Query { 654 func AddNewerFilter(q *ds.Query, t time.Time) *ds.Query {
655 return q.Gt("Created", t.UTC()).Order("-Created") 655 return q.Gt("Created", t.UTC()).Order("-Created")
656 } 656 }
OLDNEW
« no previous file with comments | « appengine/logdog/coordinator/endpoints/services/terminateStream.go ('k') | appengine/logdog/coordinator/logStream_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698