setCompressionThreshold changes the engage threshold (bytes) on the live layer and mirrors it to the env var for rebuilt layers.
(raw string)
| 129 | // setCompressionThreshold changes the engage threshold (bytes) on the live |
| 130 | // layer and mirrors it to the env var for rebuilt layers. |
| 131 | func (cli *ChatCLI) setCompressionThreshold(raw string) { |
| 132 | if cli.compressionLayer == nil { |
| 133 | fmt.Println(colorize(" ❌ "+i18n.T("cfg.compression.unavailable"), ColorRed)) |
| 134 | return |
| 135 | } |
| 136 | n, err := strconv.Atoi(strings.TrimSpace(raw)) |
| 137 | if err != nil || n < 0 { |
| 138 | fmt.Println(colorize(" ❌ "+i18n.T("cfg.compression.threshold_invalid", raw), ColorRed)) |
| 139 | return |
| 140 | } |
| 141 | prev := cli.compressionLayer.Threshold() |
| 142 | cli.compressionLayer.SetThreshold(n) |
| 143 | _ = os.Setenv("CHATCLI_COMPRESSION_THRESHOLD", strconv.Itoa(n)) |
| 144 | |
| 145 | if prev == n { |
| 146 | fmt.Println(colorize(" ✔ "+i18n.T("cfg.compression.threshold_noop", n), ColorGray)) |
| 147 | } else { |
| 148 | fmt.Println(colorize(" ✔ "+i18n.T("cfg.compression.threshold_ok", prev, n), ColorGreen)) |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | // pruneCompressionStore runs an on-demand curation pass over the CCR store |
| 153 | // (TTL-expired entries + size-cap eviction) and reports what was freed, so the |
no test coverage detected