use one readerCache for the whole file

This commit is contained in:
chrislu
2023-01-16 22:43:02 -08:00
parent 11d055bfc1
commit bfe5d910c6
7 changed files with 24 additions and 17 deletions

View File

@@ -12,13 +12,15 @@ type ChunkGroup struct {
chunkCache chunk_cache.ChunkCache
sections map[SectionIndex]*FileChunkSection
sectionsLock sync.RWMutex
readerCache *ReaderCache
}
func NewChunkGroup(lookupFn wdclient.LookupFileIdFunctionType, chunkCache chunk_cache.ChunkCache, chunks []*filer_pb.FileChunk) (*ChunkGroup, error) {
group := &ChunkGroup{
lookupFn: lookupFn,
chunkCache: chunkCache,
sections: make(map[SectionIndex]*FileChunkSection),
lookupFn: lookupFn,
chunkCache: chunkCache,
sections: make(map[SectionIndex]*FileChunkSection),
readerCache: NewReaderCache(32, chunkCache, lookupFn),
}
err := group.SetChunks(chunks)