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

Unified Diff: client/cmd/isolate/checker.go

Issue 2992693002: isolate: add uploadtracker tests for symlinks and isolated files (Closed)
Patch Set: address review comments Created 3 years, 5 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 | « no previous file | client/cmd/isolate/upload_tracker.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cmd/isolate/checker.go
diff --git a/client/cmd/isolate/checker.go b/client/cmd/isolate/checker.go
index 161c7323c66972658643f6ed66668ae6966687bc..8aac6b073386ddb622fbdd4217e8f9454a406f59 100644
--- a/client/cmd/isolate/checker.go
+++ b/client/cmd/isolate/checker.go
@@ -33,6 +33,13 @@ type isolateService interface {
Push(context.Context, *isolatedclient.PushState, isolatedclient.Source) error
}
+// A Checker checks whether items are available on the server.
+// It has a single implementation, *BundlingChecker. See BundlingChecker for method documentation.
+type Checker interface {
+ AddItem(item *Item, isolated bool, callback CheckerCallback)
+ Close() error
+}
+
// CheckerCallback is the callback used by Checker to indicate whether a file is
// present on the isolate server. If the item not present, the callback will be
// include the PushState necessary to upload it. Otherwise, the PushState will
@@ -45,10 +52,10 @@ type checkerItem struct {
callback CheckerCallback
}
-// Checker uses the isolatedclient.Client to check whether items are available
+// BundlingChecker uses the isolatedclient.Client to check whether items are available
// on the server.
-// Checker methods are safe to call concurrently.
-type Checker struct {
+// BundlingChecker methods are safe to call concurrently.
+type BundlingChecker struct {
ctx context.Context
svc isolateService
bundler *bundler.Bundler
@@ -68,14 +75,14 @@ func (cb *CountBytes) addFile(size int64) {
cb.Bytes += size
}
-// NewChecker creates a NewChecker with the given isolated client.
+// NewChecker creates a new Checker with the given isolated client.
// The provided context is used to make all requests to the isolate server.
-func NewChecker(ctx context.Context, client *isolatedclient.Client) *Checker {
+func NewChecker(ctx context.Context, client *isolatedclient.Client) *BundlingChecker {
return newChecker(ctx, client)
}
-func newChecker(ctx context.Context, svc isolateService) *Checker {
- c := &Checker{
+func newChecker(ctx context.Context, svc isolateService) *BundlingChecker {
+ c := &BundlingChecker{
svc: svc,
ctx: ctx,
}
@@ -99,7 +106,7 @@ func newChecker(ctx context.Context, svc isolateService) *Checker {
// callback asynchronously. The isolated param indicates whether the given item
// represents a JSON isolated manifest (as opposed to a regular file).
// In the case of an error, the callback may never be invoked.
-func (c *Checker) AddItem(item *Item, isolated bool, callback CheckerCallback) {
+func (c *BundlingChecker) AddItem(item *Item, isolated bool, callback CheckerCallback) {
if err := c.bundler.Add(checkerItem{item, isolated, callback}, 0); err != nil {
// An error is only returned if the size is too big, but we always use
// zero size so no error is possible.
@@ -112,7 +119,7 @@ func (c *Checker) AddItem(item *Item, isolated bool, callback CheckerCallback) {
// the checking process, if any.
// After Close has returned, Checker is guaranteed to no longer invoke any
// previously-provided callback.
-func (c *Checker) Close() error {
+func (c *BundlingChecker) Close() error {
c.bundler.Flush()
// After Close has returned, we know there are no outstanding running
// checks.
@@ -121,7 +128,7 @@ func (c *Checker) Close() error {
// check is invoked from the bundler's handler. As such, it is only ever run
// one invocation at a time.
-func (c *Checker) check(items []checkerItem) error {
+func (c *BundlingChecker) check(items []checkerItem) error {
var digests []*service.HandlersEndpointsV1Digest
for _, item := range items {
digests = append(digests, &service.HandlersEndpointsV1Digest{
« no previous file with comments | « no previous file | client/cmd/isolate/upload_tracker.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698