| 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/common/api/logdog_coordinator/services/v1" | 13 "github.com/luci/luci-go/common/api/logdog_coordinator/services/v1" |
| 14 "github.com/luci/luci-go/common/clock" | 14 "github.com/luci/luci-go/common/clock" |
| 15 "github.com/luci/luci-go/common/grpcutil" | 15 "github.com/luci/luci-go/common/grpcutil" |
| 16 "github.com/luci/luci-go/common/logdog/types" | 16 "github.com/luci/luci-go/common/logdog/types" |
| 17 log "github.com/luci/luci-go/common/logging" | 17 log "github.com/luci/luci-go/common/logging" |
| 18 "github.com/luci/luci-go/common/proto/google" | 18 "github.com/luci/luci-go/common/proto/google" |
| 19 "golang.org/x/net/context" | 19 "golang.org/x/net/context" |
| 20 "google.golang.org/grpc/codes" | 20 "google.golang.org/grpc/codes" |
| 21 ) | 21 ) |
| 22 | 22 |
| 23 // TerminateStream is an idempotent stream state terminate operation. | 23 // TerminateStream is an idempotent stream state terminate operation. |
| 24 func (s *server) TerminateStream(c context.Context, req *logdog.TerminateStreamR
equest) (*google.Empty, error) { | 24 func (s *server) TerminateStream(c context.Context, req *logdog.TerminateStreamR
equest) (*google.Empty, error) { |
| 25 log.Fields{ | 25 log.Fields{ |
| 26 "project": req.Project, |
| 26 "path": req.Path, | 27 "path": req.Path, |
| 27 "terminalIndex": req.TerminalIndex, | 28 "terminalIndex": req.TerminalIndex, |
| 28 }.Infof(c, "Request to terminate log stream.") | 29 }.Infof(c, "Request to terminate log stream.") |
| 29 | 30 |
| 30 if req.TerminalIndex < 0 { | 31 if req.TerminalIndex < 0 { |
| 31 return nil, grpcutil.Errf(codes.InvalidArgument, "Negative termi
nal index.") | 32 return nil, grpcutil.Errf(codes.InvalidArgument, "Negative termi
nal index.") |
| 32 } | 33 } |
| 33 | 34 |
| 34 path := types.StreamPath(req.Path) | 35 path := types.StreamPath(req.Path) |
| 35 if err := path.Validate(); err != nil { | 36 if err := path.Validate(); err != nil { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 }, nil) | 125 }, nil) |
| 125 if err != nil { | 126 if err != nil { |
| 126 log.Fields{ | 127 log.Fields{ |
| 127 log.ErrorKey: err, | 128 log.ErrorKey: err, |
| 128 }.Errorf(c, "Failed to update LogStream.") | 129 }.Errorf(c, "Failed to update LogStream.") |
| 129 return nil, err | 130 return nil, err |
| 130 } | 131 } |
| 131 | 132 |
| 132 return &google.Empty{}, nil | 133 return &google.Empty{}, nil |
| 133 } | 134 } |
| OLD | NEW |