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

Side by Side Diff: logdog/common/storage/archive/logdog_archive_test/main.go

Issue 2538203002: LogDog: Add signed GS URL fetching. (Closed)
Patch Set: Created 4 years 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 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 // Package main implements a simple CLI tool to load and interact with Google 5 // Package main implements a simple CLI tool to load and interact with Google
6 // Storage archived data. 6 // Storage archived data.
7 package main 7 package main
8 8
9 import ( 9 import (
10 "bytes" 10 "bytes"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 client, err := app.getGSClient(c) 312 client, err := app.getGSClient(c)
313 if err != nil { 313 if err != nil {
314 log.WithError(err).Errorf(c, "Failed to create GS client.") 314 log.WithError(err).Errorf(c, "Failed to create GS client.")
315 return 1 315 return 1
316 } 316 }
317 defer client.Close() 317 defer client.Close()
318 318
319 stClient, err := archive.New(c, archive.Options{ 319 stClient, err := archive.New(c, archive.Options{
320 » » IndexURL: cmd.indexPath, 320 » » Index: gs.Path(cmd.indexPath),
321 » » StreamURL: cmd.streamPath, 321 » » Stream: gs.Path(cmd.streamPath),
322 » » Client: client, 322 » » Client: client,
323 }) 323 })
324 if err != nil { 324 if err != nil {
325 log.WithError(err).Errorf(c, "Failed to create storage client.") 325 log.WithError(err).Errorf(c, "Failed to create storage client.")
326 return 1 326 return 1
327 } 327 }
328 defer stClient.Close() 328 defer stClient.Close()
329 329
330 var innerErr error 330 var innerErr error
331 err = stClient.Get(storage.GetRequest{ 331 err = stClient.Get(storage.GetRequest{
332 Index: types.MessageIndex(cmd.index), 332 Index: types.MessageIndex(cmd.index),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 398 }
399 399
400 client, err := app.getGSClient(c) 400 client, err := app.getGSClient(c)
401 if err != nil { 401 if err != nil {
402 log.WithError(err).Errorf(c, "Failed to create GS client.") 402 log.WithError(err).Errorf(c, "Failed to create GS client.")
403 return 1 403 return 1
404 } 404 }
405 defer client.Close() 405 defer client.Close()
406 406
407 stClient, err := archive.New(c, archive.Options{ 407 stClient, err := archive.New(c, archive.Options{
408 » » IndexURL: cmd.indexPath, 408 » » Index: gs.Path(cmd.indexPath),
409 » » StreamURL: cmd.streamPath, 409 » » Stream: gs.Path(cmd.streamPath),
410 » » Client: client, 410 » » Client: client,
411 }) 411 })
412 if err != nil { 412 if err != nil {
413 log.WithError(err).Errorf(c, "Failed to create storage client.") 413 log.WithError(err).Errorf(c, "Failed to create storage client.")
414 return 1 414 return 1
415 } 415 }
416 defer stClient.Close() 416 defer stClient.Close()
417 417
418 e, err := stClient.Tail("", "") 418 e, err := stClient.Tail("", "")
419 if err != nil { 419 if err != nil {
420 log.WithError(err).Errorf(c, "Failed to Tail log entries.") 420 log.WithError(err).Errorf(c, "Failed to Tail log entries.")
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } 481 }
482 482
483 log.Fields{ 483 log.Fields{
484 "index": frameIndex, 484 "index": frameIndex,
485 "size": buf.Len(), 485 "size": buf.Len(),
486 }.Debugf(c, "Read frame.") 486 }.Debugf(c, "Read frame.")
487 frameIndex++ 487 frameIndex++
488 } 488 }
489 return nil 489 return nil
490 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698