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

Unified Diff: go/src/infra/tools/cipd/local/reader.go

Issue 1129043003: cipd: Refactor client to make it more readable. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « go/src/infra/tools/cipd/local/pkgdef_test.go ('k') | go/src/infra/tools/cipd/local/reader_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/tools/cipd/local/reader.go
diff --git a/go/src/infra/tools/cipd/reader.go b/go/src/infra/tools/cipd/local/reader.go
similarity index 93%
rename from go/src/infra/tools/cipd/reader.go
rename to go/src/infra/tools/cipd/local/reader.go
index 5370c25100a44a7db5c2ccab5e121504d24bcde2..4742141b40827f480cc551a82c44acaa1a167431 100644
--- a/go/src/infra/tools/cipd/reader.go
+++ b/go/src/infra/tools/cipd/local/reader.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package cipd
+package local
import (
"archive/zip"
@@ -12,16 +12,16 @@ import (
"io"
"io/ioutil"
"os"
+
+ "infra/tools/cipd/common"
)
// PackageInstance represents a binary package file.
type PackageInstance interface {
// Close shuts down the package and its data provider.
Close() error
- // PackageName returns package name, as defined in the manifest.
- PackageName() string
- // InstanceID returns id that identifies particular built of the package. It's a hash of the package data.
- InstanceID() string
+ // Pin identifies package name and concreted package instance ID of this package file.
+ Pin() common.Pin
// Files returns a list of files inside the package.
Files() []File
// DataReader returns reader that reads raw package data.
@@ -186,8 +186,13 @@ func (inst *packageInstance) Close() error {
return nil
}
-func (inst *packageInstance) InstanceID() string { return inst.instanceID }
-func (inst *packageInstance) PackageName() string { return inst.manifest.PackageName }
+func (inst *packageInstance) Pin() common.Pin {
+ return common.Pin{
+ PackageName: inst.manifest.PackageName,
+ InstanceID: inst.instanceID,
+ }
+}
+
func (inst *packageInstance) Files() []File { return inst.files }
func (inst *packageInstance) DataReader() io.ReadSeeker { return inst.data }
« no previous file with comments | « go/src/infra/tools/cipd/local/pkgdef_test.go ('k') | go/src/infra/tools/cipd/local/reader_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698