| 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 ds "github.com/luci/gae/service/datastore" | 8 ds "github.com/luci/gae/service/datastore" |
| 9 "github.com/luci/luci-go/appengine/logdog/coordinator" | 9 "github.com/luci/luci-go/appengine/logdog/coordinator" |
| 10 "github.com/luci/luci-go/common/api/logdog_coordinator/services/v1" | 10 "github.com/luci/luci-go/common/api/logdog_coordinator/services/v1" |
| 11 "github.com/luci/luci-go/common/clock" | 11 "github.com/luci/luci-go/common/clock" |
| 12 "github.com/luci/luci-go/common/grpcutil" | 12 "github.com/luci/luci-go/common/grpcutil" |
| 13 "github.com/luci/luci-go/common/logdog/types" | 13 "github.com/luci/luci-go/common/logdog/types" |
| 14 log "github.com/luci/luci-go/common/logging" | 14 log "github.com/luci/luci-go/common/logging" |
| 15 "github.com/luci/luci-go/common/proto/google" | 15 "github.com/luci/luci-go/common/proto/google" |
| 16 "golang.org/x/net/context" | 16 "golang.org/x/net/context" |
| 17 "google.golang.org/grpc/codes" | 17 "google.golang.org/grpc/codes" |
| 18 ) | 18 ) |
| 19 | 19 |
| 20 func (b *server) ArchiveStream(c context.Context, req *logdog.ArchiveStreamReque
st) (*google.Empty, error) { | 20 func (b *server) ArchiveStream(c context.Context, req *logdog.ArchiveStreamReque
st) (*google.Empty, error) { |
| 21 log.Fields{ | 21 log.Fields{ |
| 22 "project": req.Project, |
| 22 "path": req.Path, | 23 "path": req.Path, |
| 23 "complete": req.Complete(), | 24 "complete": req.Complete(), |
| 24 "terminalIndex": req.TerminalIndex, | 25 "terminalIndex": req.TerminalIndex, |
| 25 "logEntryCount": req.LogEntryCount, | 26 "logEntryCount": req.LogEntryCount, |
| 26 "error": req.Error, | 27 "error": req.Error, |
| 27 }.Infof(c, "Received archival request.") | 28 }.Infof(c, "Received archival request.") |
| 28 | 29 |
| 29 // Verify that the request is minimially valid. | 30 // Verify that the request is minimially valid. |
| 30 path := types.StreamPath(req.Path) | 31 path := types.StreamPath(req.Path) |
| 31 if err := path.Validate(); err != nil { | 32 if err := path.Validate(); err != nil { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 log.WithError(ierr).Errorf(c, "Failed to mark stream as archived
.") | 120 log.WithError(ierr).Errorf(c, "Failed to mark stream as archived
.") |
| 120 return nil, ierr | 121 return nil, ierr |
| 121 } | 122 } |
| 122 if err != nil { | 123 if err != nil { |
| 123 log.WithError(err).Errorf(c, "Internal error.") | 124 log.WithError(err).Errorf(c, "Internal error.") |
| 124 return nil, grpcutil.Internal | 125 return nil, grpcutil.Internal |
| 125 } | 126 } |
| 126 | 127 |
| 127 return &google.Empty{}, nil | 128 return &google.Empty{}, nil |
| 128 } | 129 } |
| OLD | NEW |