| OLD | NEW |
| 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 services | 5 package services |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "crypto/subtle" | 8 "crypto/subtle" |
| 9 | 9 |
| 10 ds "github.com/luci/gae/service/datastore" | 10 ds "github.com/luci/gae/service/datastore" |
| 11 "github.com/luci/gae/service/info" | 11 "github.com/luci/gae/service/info" |
| 12 "github.com/luci/luci-go/appengine/logdog/coordinator" | 12 "github.com/luci/luci-go/appengine/logdog/coordinator" |
| 13 "github.com/luci/luci-go/appengine/logdog/coordinator/mutations" | 13 "github.com/luci/luci-go/appengine/logdog/coordinator/mutations" |
| 14 "github.com/luci/luci-go/appengine/tumble" | 14 "github.com/luci/luci-go/appengine/tumble" |
| 15 "github.com/luci/luci-go/common/api/logdog_coordinator/services/v1" | 15 "github.com/luci/luci-go/common/api/logdog_coordinator/services/v1" |
| 16 "github.com/luci/luci-go/common/clock" | 16 "github.com/luci/luci-go/common/clock" |
| 17 "github.com/luci/luci-go/common/grpcutil" | 17 "github.com/luci/luci-go/common/grpcutil" |
| 18 "github.com/luci/luci-go/common/logdog/types" | 18 "github.com/luci/luci-go/common/logdog/types" |
| 19 log "github.com/luci/luci-go/common/logging" | 19 log "github.com/luci/luci-go/common/logging" |
| 20 "github.com/luci/luci-go/common/proto/google" | 20 "github.com/luci/luci-go/common/proto/google" |
| 21 "golang.org/x/net/context" | 21 "golang.org/x/net/context" |
| 22 "google.golang.org/grpc/codes" | 22 "google.golang.org/grpc/codes" |
| 23 ) | 23 ) |
| 24 | 24 |
| 25 // TerminateStream is an idempotent stream state terminate operation. | 25 // TerminateStream is an idempotent stream state terminate operation. |
| 26 func (s *server) TerminateStream(c context.Context, req *logdog.TerminateStreamR
equest) (*google.Empty, error) { | 26 func (s *server) TerminateStream(c context.Context, req *logdog.TerminateStreamR
equest) (*google.Empty, error) { |
| 27 log.Fields{ | 27 log.Fields{ |
| 28 "project": req.Project, |
| 28 "path": req.Path, | 29 "path": req.Path, |
| 29 "terminalIndex": req.TerminalIndex, | 30 "terminalIndex": req.TerminalIndex, |
| 30 }.Infof(c, "Request to terminate log stream.") | 31 }.Infof(c, "Request to terminate log stream.") |
| 31 | 32 |
| 32 if req.TerminalIndex < 0 { | 33 if req.TerminalIndex < 0 { |
| 33 return nil, grpcutil.Errf(codes.InvalidArgument, "Negative termi
nal index.") | 34 return nil, grpcutil.Errf(codes.InvalidArgument, "Negative termi
nal index.") |
| 34 } | 35 } |
| 35 | 36 |
| 36 path := types.StreamPath(req.Path) | 37 path := types.StreamPath(req.Path) |
| 37 if err := path.Validate(); err != nil { | 38 if err := path.Validate(); err != nil { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 }, nil) | 137 }, nil) |
| 137 if err != nil { | 138 if err != nil { |
| 138 log.Fields{ | 139 log.Fields{ |
| 139 log.ErrorKey: err, | 140 log.ErrorKey: err, |
| 140 }.Errorf(c, "Failed to update LogStream.") | 141 }.Errorf(c, "Failed to update LogStream.") |
| 141 return nil, err | 142 return nil, err |
| 142 } | 143 } |
| 143 | 144 |
| 144 return &google.Empty{}, nil | 145 return &google.Empty{}, nil |
| 145 } | 146 } |
| OLD | NEW |