| OLD | NEW |
| 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 | 5 package main |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "log" | 8 "log" |
| 9 "time" | 9 "time" |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // NewChecker creates a NewChecker with the given isolated client. | 60 // NewChecker creates a NewChecker with the given isolated client. |
| 61 // The provided context is used to make all requests to the isolate server. | 61 // The provided context is used to make all requests to the isolate server. |
| 62 func NewChecker(ctx context.Context, client *isolatedclient.Client) *Checker { | 62 func NewChecker(ctx context.Context, client *isolatedclient.Client) *Checker { |
| 63 return newChecker(ctx, client) | 63 return newChecker(ctx, client) |
| 64 } | 64 } |
| 65 | 65 |
| 66 func newChecker(ctx context.Context, svc isolateService) *Checker { | 66 func newChecker(ctx context.Context, svc isolateService) *Checker { |
| 67 c := &Checker{ | 67 c := &Checker{ |
| 68 svc: svc, | 68 svc: svc, |
| 69 ctx: ctx, |
| 69 } | 70 } |
| 70 c.bundler = bundler.NewBundler(checkerItem{}, func(bundle interface{}) { | 71 c.bundler = bundler.NewBundler(checkerItem{}, func(bundle interface{}) { |
| 71 items := bundle.([]checkerItem) | 72 items := bundle.([]checkerItem) |
| 72 if c.err != nil { | 73 if c.err != nil { |
| 73 for _, item := range items { | 74 for _, item := range items { |
| 74 // Drop any more incoming items. | 75 // Drop any more incoming items. |
| 75 log.Printf("WARNING dropped %q from Checker", it
em.item.Path) | 76 log.Printf("WARNING dropped %q from Checker", it
em.item.Path) |
| 76 } | 77 } |
| 77 return | 78 return |
| 78 } | 79 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if size := item.item.Size; out[i] == nil { | 127 if size := item.item.Size; out[i] == nil { |
| 127 c.Hit.addFile(size) | 128 c.Hit.addFile(size) |
| 128 } else { | 129 } else { |
| 129 c.Miss.addFile(size) | 130 c.Miss.addFile(size) |
| 130 } | 131 } |
| 131 | 132 |
| 132 item.callback(item.item, out[i]) | 133 item.callback(item.item, out[i]) |
| 133 } | 134 } |
| 134 return nil | 135 return nil |
| 135 } | 136 } |
| OLD | NEW |