// there are no more than MaxBlocks left.
func (c *BlockCache) Sweep() {
max := c.MaxBlocks
- if max < defaultMaxBlocks {
+ if max == 0 {
max = defaultMaxBlocks
}
c.mtx.Lock()
}
}
+func (kc *KeepClient) ClearBlockCache() {
+ kc.cache().Clear()
+}
+
var (
// There are four global http.Client objects for the four
// possible permutations of TLS behavior (verify/skip-verify)
type IKeepClient interface {
PutHB(hash string, buf []byte) (string, int, error)
ManifestFileReader(m manifest.Manifest, filename string) (arvados.File, error)
+ ClearBlockCache()
}
// NewLogWriter is a factory function to create a new log writer.
runner.ContainerConfig.Image = imageID
- keepclient.DefaultBlockCache.Clear()
+ runner.Kc.ClearBlockCache()
return nil
}
if err != nil {
log.Fatalf("%s: %v", containerId, err)
}
+ kc.BlockCache = &keepclient.BlockCache{MaxBlocks: 2}
kc.Retries = 4
var docker *dockerclient.Client
return fmt.Sprintf("%s+%d", hash, len(buf)), len(buf), nil
}
+func (*KeepTestClient) ClearBlockCache() {
+}
+
type FileWrapper struct {
io.ReadCloser
len int64
return nil, errors.New("KeepError")
}
+func (KeepErrorTestClient) ClearBlockCache() {
+}
+
type KeepReadErrorTestClient struct{}
func (KeepReadErrorTestClient) PutHB(hash string, buf []byte) (string, int, error) {
return "", 0, nil
}
+func (KeepReadErrorTestClient) ClearBlockCache() {
+}
+
type ErrorReader struct{}
func (ErrorReader) Read(p []byte) (n int, err error) {