Files
stfs/internal/check/filesystem.go
Felicitas Pojtinger 5089333d13 feat: Make STFS API public
Also: Happy new year :)
2021-12-31 23:57:21 +01:00

36 lines
644 B
Go

package check
import "github.com/pojntfx/stfs/pkg/config"
func CheckFileSystemCacheType(cacheType string) error {
cacheTypeIsKnown := false
for _, candidate := range config.KnownFileSystemCacheTypes {
if cacheType == candidate {
cacheTypeIsKnown = true
}
}
if !cacheTypeIsKnown {
return config.ErrFileSystemCacheTypeUnknown
}
return nil
}
func CheckWriteCacheType(cacheType string) error {
cacheTypeIsKnown := false
for _, candidate := range config.KnownWriteCacheTypes {
if cacheType == candidate {
cacheTypeIsKnown = true
}
}
if !cacheTypeIsKnown {
return config.ErrWriteCacheTypeUnknown
}
return nil
}