| 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 archiver | 5 package archiver |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "encoding/json" | 9 "encoding/json" |
| 10 "fmt" | 10 "fmt" |
| 11 "log" | 11 "log" |
| 12 "os" | 12 "os" |
| 13 "path/filepath" | 13 "path/filepath" |
| 14 "strings" | 14 "strings" |
| 15 "sync" | 15 "sync" |
| 16 | 16 |
| 17 "github.com/luci/luci-go/client/internal/tracer" | 17 "github.com/luci/luci-go/client/internal/tracer" |
| 18 "github.com/luci/luci-go/client/isolatedclient" |
| 18 "github.com/luci/luci-go/common/isolated" | 19 "github.com/luci/luci-go/common/isolated" |
| 19 ) | 20 ) |
| 20 | 21 |
| 21 // SimpleFuture is a Future that can be edited. | 22 // SimpleFuture is a Future that can be edited. |
| 22 type SimpleFuture interface { | 23 type SimpleFuture interface { |
| 23 Future | 24 Future |
| 24 Finalize(d isolated.HexDigest, err error) | 25 Finalize(d isolated.HexDigest, err error) |
| 25 } | 26 } |
| 26 | 27 |
| 27 // NewSimpleFuture returns a SimpleFuture for asynchronous work. | 28 // NewSimpleFuture returns a SimpleFuture for asynchronous work. |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 246 } |
| 246 name := future.DisplayName() | 247 name := future.DisplayName() |
| 247 d := i.Files[name] | 248 d := i.Files[name] |
| 248 d.Digest = future.Digest() | 249 d.Digest = future.Digest() |
| 249 i.Files[name] = d | 250 i.Files[name] = d |
| 250 } | 251 } |
| 251 var d isolated.HexDigest | 252 var d isolated.HexDigest |
| 252 if err == nil { | 253 if err == nil { |
| 253 raw := &bytes.Buffer{} | 254 raw := &bytes.Buffer{} |
| 254 if err = json.NewEncoder(raw).Encode(i); err == nil { | 255 if err = json.NewEncoder(raw).Encode(i); err == nil { |
| 255 » » » » if f := a.Push(displayName, bytes.NewReader(raw.
Bytes()), 0); f != nil { | 256 » » » » if f := a.Push(displayName, isolatedclient.NewBy
tesSource(raw.Bytes()), 0); f != nil { |
| 256 f.WaitForHashed() | 257 f.WaitForHashed() |
| 257 err = f.Error() | 258 err = f.Error() |
| 258 d = f.Digest() | 259 d = f.Digest() |
| 259 } | 260 } |
| 260 } | 261 } |
| 261 } | 262 } |
| 262 s.Finalize(d, err) | 263 s.Finalize(d, err) |
| 263 }() | 264 }() |
| 264 return s | 265 return s |
| 265 } | 266 } |
| OLD | NEW |