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

Side by Side Diff: appengine/logdog/coordinator/coordinatorTest/archival.go

Issue 1863973002: LogDog: Update to archival V2. (Closed) Base URL: https://github.com/luci/luci-go@grpcutil-errors
Patch Set: Minor fixes, works in dev now. Created 4 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 package coordinatorTest
6
7 import (
8 "fmt"
9 "sort"
10
11 "github.com/golang/protobuf/proto"
12 tq "github.com/luci/gae/service/taskqueue"
13 "github.com/luci/luci-go/common/api/logdog_coordinator/services/v1"
14 "github.com/luci/luci-go/common/logdog/types"
15 )
16
17 // GetArchiveTaskStreams returns the set of archive tasks in the supplied task
18 // queue.
19 //
20 // If one of the tasks in the specified queue is not an ArchiveTask, an error
21 // will be returned.
22 func GetArchiveTaskStreams(ti tq.Interface, qname string) ([]string, error) {
23 queueContents := ti.Testable().GetScheduledTasks()[qname]
24
25 archiveTasks := make([]string, 0, len(queueContents))
26 for _, task := range queueContents {
27 var at logdog.ArchiveTask
28 if err := proto.Unmarshal(task.Payload, &at); err != nil {
29 return nil, fmt.Errorf("failed to unmarshal payload: %v" , err)
30 }
31
32 _, name := types.StreamPath(at.Path).Split()
33 archiveTasks = append(archiveTasks, string(name))
34 }
35
36 sort.Strings(archiveTasks)
37 return archiveTasks, nil
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698