chunk cache adds function ReadChunkAt
This commit is contained in:
@@ -108,6 +108,26 @@ func (c *OnDiskCacheLayer) getChunkSlice(needleId types.NeedleId, offset, length
|
||||
|
||||
}
|
||||
|
||||
func (c *OnDiskCacheLayer) readChunkAt(buffer []byte, needleId types.NeedleId, offset uint64) (n int, err error) {
|
||||
|
||||
for _, diskCache := range c.diskCaches {
|
||||
n, err = diskCache.readNeedleSliceAt(buffer, needleId, offset)
|
||||
if err == storage.ErrorNotFound {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
glog.Warningf("failed to read cache file %s id %d: %v", diskCache.fileName, needleId, err)
|
||||
continue
|
||||
}
|
||||
if n > 0 {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
func (c *OnDiskCacheLayer) shutdown() {
|
||||
|
||||
for _, diskCache := range c.diskCaches {
|
||||
|
||||
Reference in New Issue
Block a user