Resolve producer modes turn allowances cache controls and shared workers

This commit is contained in:
2026-11-21 22:49:41 +00:00
parent cc14a7a5cc
commit 40fbcc61b1
26 changed files with 655 additions and 1405 deletions

View File

@@ -3,19 +3,9 @@ package config
import (
"fmt"
"path/filepath"
"strings"
)
// DefaultChunkPlanRoot resolves the existing per-user chunk-plan cache root.
func DefaultChunkPlanRoot(userCacheDir func() (string, error)) (string, error) {
return defaultCacheFamilyRoot(userCacheDir, "chunk-plans")
}
func DefaultCheckpointRoot(userCacheDir func() (string, error)) (string, error) {
return defaultCacheFamilyRoot(userCacheDir, "checkpoints")
}
func defaultCacheFamilyRoot(userCacheDir func() (string, error), family string) (string, error) {
func DefaultCacheRoot(userCacheDir func() (string, error)) (string, error) {
if userCacheDir == nil {
return "", fmt.Errorf("user cache directory resolver must not be nil")
}
@@ -23,9 +13,8 @@ func defaultCacheFamilyRoot(userCacheDir func() (string, error), family string)
if err != nil {
return "", fmt.Errorf("resolve user cache directory: %w", err)
}
root = strings.TrimSpace(root)
if root == "" {
return "", fmt.Errorf("user cache directory must not be empty")
}
return filepath.Join(filepath.Clean(root), "notarius", family), nil
return filepath.Join(root, "notarius"), nil
}