Files
pixa/internal/imgcache/cachesize.go
T
clawbot c13cd033a9 Test that the default cache_max_bytes counts what the cache holds
With a fake free-space probe, an empty cache with 4 GiB free gets a
3 GiB default, and the same cache once it holds those 3 GiB, with
1 GiB left free, must keep 3 GiB. The default is still 75% of the
free space alone, so the second check fails: this is the bug in
#184. computeDefaultMaxBytes
only calls the config's existing computation so the test compiles.

Model: opus-5-5
2026-10-04 17:03:22 +00:00

18 lines
454 B
Go

package imgcache
import (
"context"
"path/filepath"
"sneak.berlin/go/pixa/internal/config"
)
// computeDefaultMaxBytes returns the default cache size limit for an
// omitted cache_max_bytes, for the filesystem holding <state_dir>/cache/.
func (c *Cache) computeDefaultMaxBytes(
_ context.Context, probe config.FreeSpaceProbeFunc,
) (int64, error) {
return config.ComputeDefaultCacheMaxBytes(
filepath.Join(c.config.StateDir, "cache"), probe)
}