Add support for caching multipart in writethrough mode (#13507)

This commit is contained in:
Poorna K
2021-11-01 11:11:58 -04:00
committed by GitHub
parent 6d53e3c2d7
commit 15dcacc1fc
7 changed files with 975 additions and 91 deletions

View File

@@ -39,7 +39,7 @@ type Config struct {
WatermarkLow int `json:"watermark_low"`
WatermarkHigh int `json:"watermark_high"`
Range bool `json:"range"`
CommitWriteback bool `json:"-"`
CacheCommitMode string `json:"commit_mode"`
}
// UnmarshalJSON - implements JSON unmarshal interface for unmarshalling
@@ -155,12 +155,11 @@ func parseCacheExcludes(excludes string) ([]string, error) {
return excludesSlice, nil
}
func parseCacheCommitMode(commitStr string) (bool, error) {
func parseCacheCommitMode(commitStr string) (string, error) {
switch strings.ToLower(commitStr) {
case "writeback":
return true, nil
case "writethrough":
return false, nil
case "writeback", "writethrough":
return strings.ToLower(commitStr), nil
default:
return "", config.ErrInvalidCacheCommitValue(nil).Msg("cache commit value must be `writeback` or `writethrough`")
}
return false, config.ErrInvalidCacheCommitValue(nil).Msg("cache commit value must be `writeback` or `writethrough`")
}