Add chunk plan cache configuration and storage
This commit is contained in:
29
internal/framework/pipeline/chunk_cache.go
Normal file
29
internal/framework/pipeline/chunk_cache.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package pipeline
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ChunkCacheMode string
|
||||
|
||||
const (
|
||||
ChunkCacheAuto ChunkCacheMode = "auto"
|
||||
ChunkCacheBypass ChunkCacheMode = "bypass"
|
||||
ChunkCacheRefresh ChunkCacheMode = "refresh"
|
||||
)
|
||||
|
||||
func ParseChunkCacheMode(raw string) (ChunkCacheMode, error) {
|
||||
mode := ChunkCacheMode(strings.TrimSpace(raw))
|
||||
switch mode {
|
||||
case ChunkCacheAuto, ChunkCacheBypass, ChunkCacheRefresh:
|
||||
return mode, nil
|
||||
default:
|
||||
return "", fmt.Errorf("chunk cache mode %q is not supported", strings.TrimSpace(raw))
|
||||
}
|
||||
}
|
||||
|
||||
func (m ChunkCacheMode) Validate() error {
|
||||
_, err := ParseChunkCacheMode(string(m))
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user