| 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 cipd implements client side of Chrome Infra Package Deployer. | 5 // Package cipd implements client side of Chrome Infra Package Deployer. |
| 6 // | 6 // |
| 7 // Binary package file format (in free form representation): | 7 // Binary package file format (in free form representation): |
| 8 // <binary package> := <zipped data> | 8 // <binary package> := <zipped data> |
| 9 // <zipped data> := DeterministicZip(<all input files> + <manifest json>) | 9 // <zipped data> := DeterministicZip(<all input files> + <manifest json>) |
| 10 // <manifest json> := File{ | 10 // <manifest json> := File{ |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 f(cache) | 469 f(cache) |
| 470 | 470 |
| 471 if cache.Dirty() { | 471 if cache.Dirty() { |
| 472 // It's tiny in size (and protobuf can't serialize to io.Reader
anyway). Dump | 472 // It's tiny in size (and protobuf can't serialize to io.Reader
anyway). Dump |
| 473 // it to disk via FileSystem object to deal with possible concur
rent updates, | 473 // it to disk via FileSystem object to deal with possible concur
rent updates, |
| 474 // missing directories, etc. | 474 // missing directories, etc. |
| 475 fs := local.NewFileSystem(filepath.Dir(path), client.Logger) | 475 fs := local.NewFileSystem(filepath.Dir(path), client.Logger) |
| 476 start = time.Now() | 476 start = time.Now() |
| 477 out, err := cache.Save() | 477 out, err := cache.Save() |
| 478 if err == nil { | 478 if err == nil { |
| 479 » » » err = fs.EnsureFile(path, bytes.NewReader(out)) | 479 » » » err = local.EnsureFile(fs, path, bytes.NewReader(out)) |
| 480 } | 480 } |
| 481 loadSaveTime += time.Since(start) | 481 loadSaveTime += time.Since(start) |
| 482 if err != nil { | 482 if err != nil { |
| 483 client.Logger.Warningf("cipd: failed to update tag cache
- %s", err) | 483 client.Logger.Warningf("cipd: failed to update tag cache
- %s", err) |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 | 486 |
| 487 if loadSaveTime > time.Second { | 487 if loadSaveTime > time.Second { |
| 488 client.Logger.Warningf("cipd: loading and saving tag cache with
%d entries took %s", cache.Len(), loadSaveTime) | 488 client.Logger.Warningf("cipd: loading and saving tag cache with
%d entries took %s", cache.Len(), loadSaveTime) |
| 489 } | 489 } |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 // buildInstanceIDMap builds mapping {package name -> instance ID}. | 1042 // buildInstanceIDMap builds mapping {package name -> instance ID}. |
| 1043 func buildInstanceIDMap(pins []common.Pin) map[string]string { | 1043 func buildInstanceIDMap(pins []common.Pin) map[string]string { |
| 1044 out := map[string]string{} | 1044 out := map[string]string{} |
| 1045 for _, p := range pins { | 1045 for _, p := range pins { |
| 1046 out[p.PackageName] = p.InstanceID | 1046 out[p.PackageName] = p.InstanceID |
| 1047 } | 1047 } |
| 1048 return out | 1048 return out |
| 1049 } | 1049 } |
| OLD | NEW |