|
@ -22,9 +22,9 @@ type TieredChunkCache struct { |
|
|
memCache *ChunkCacheInMemory |
|
|
memCache *ChunkCacheInMemory |
|
|
diskCaches []*OnDiskCacheLayer |
|
|
diskCaches []*OnDiskCacheLayer |
|
|
sync.RWMutex |
|
|
sync.RWMutex |
|
|
onDiskCacheSizeLimit0 uint64 |
|
|
|
|
|
onDiskCacheSizeLimit1 uint64 |
|
|
|
|
|
onDiskCacheSizeLimit2 uint64 |
|
|
|
|
|
|
|
|
onDiskCacheSizeLimit0 uint64 |
|
|
|
|
|
onDiskCacheSizeLimit1 uint64 |
|
|
|
|
|
onDiskCacheSizeLimit2 uint64 |
|
|
maxFilePartSizeInCache uint64 |
|
|
maxFilePartSizeInCache uint64 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -42,12 +42,15 @@ func NewTieredChunkCache(maxEntries int64, dir string, diskSizeInUnit int64, uni |
|
|
c.diskCaches[0] = NewOnDiskCacheLayer(dir, "c0_2", diskSizeInUnit*unitSize/8, 2) |
|
|
c.diskCaches[0] = NewOnDiskCacheLayer(dir, "c0_2", diskSizeInUnit*unitSize/8, 2) |
|
|
c.diskCaches[1] = NewOnDiskCacheLayer(dir, "c1_3", diskSizeInUnit*unitSize/4+diskSizeInUnit*unitSize/8, 3) |
|
|
c.diskCaches[1] = NewOnDiskCacheLayer(dir, "c1_3", diskSizeInUnit*unitSize/4+diskSizeInUnit*unitSize/8, 3) |
|
|
c.diskCaches[2] = NewOnDiskCacheLayer(dir, "c2_2", diskSizeInUnit*unitSize/2, 2) |
|
|
c.diskCaches[2] = NewOnDiskCacheLayer(dir, "c2_2", diskSizeInUnit*unitSize/2, 2) |
|
|
c.maxFilePartSizeInCache = uint64(unitSize*diskSizeInUnit)/4 |
|
|
|
|
|
|
|
|
c.maxFilePartSizeInCache = uint64(unitSize*diskSizeInUnit) / 4 |
|
|
|
|
|
|
|
|
return c |
|
|
return c |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (c *TieredChunkCache) GetMaxFilePartSizeInCache() (answer uint64) { |
|
|
func (c *TieredChunkCache) GetMaxFilePartSizeInCache() (answer uint64) { |
|
|
|
|
|
if c == nil { |
|
|
|
|
|
return 0 |
|
|
|
|
|
} |
|
|
return c.maxFilePartSizeInCache |
|
|
return c.maxFilePartSizeInCache |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|