func isValidMetadataCache()

in cfg/validate.go [120:162]


func isValidMetadataCache(v isSet, c *MetadataCacheConfig) error {
	// Validate ttl-secs.
	if v.IsSet(MetadataCacheTTLConfigKey) {
		if c.TtlSecs < -1 {
			return fmt.Errorf("the value of ttl-secs for metadata-cache can't be less than -1")
		}
		if c.TtlSecs > maxSupportedTTLInSeconds {
			return fmt.Errorf("the value of ttl-secs in metadata-cache is too high to be supported. Max is 9223372036")
		}
	}

	// Validate negative-ttl-secs.
	if v.IsSet(MetadataNegativeCacheTTLConfigKey) {
		if c.NegativeTtlSecs < -1 {
			return fmt.Errorf("the value of negative-ttl-secs for metadata-cache can't be less than -1")
		}
		if c.NegativeTtlSecs > maxSupportedTTLInSeconds {
			return fmt.Errorf("the value of negative-ttl-secs in metadata-cache is too high to be supported. Max is 9223372036")
		}
	}

	// Validate type-cache-max-size-mb.
	if c.TypeCacheMaxSizeMb < -1 {
		return fmt.Errorf("the value of type-cache-max-size-mb for metadata-cache can't be less than -1")
	}

	// Validate stat-cache-max-size-mb.
	if v.IsSet(StatCacheMaxSizeConfigKey) {
		if c.StatCacheMaxSizeMb < -1 {
			return fmt.Errorf("the value of stat-cache-max-size-mb for metadata-cache can't be less than -1")
		}
		if c.StatCacheMaxSizeMb > int64(maxSupportedStatCacheMaxSizeMB) {
			return fmt.Errorf("the value of stat-cache-max-size-mb for metadata-cache is too high! Max supported: 17592186044415")
		}
	}

	// [Deprecated] Validate stat-cache-capacity.
	if c.DeprecatedStatCacheCapacity < 0 {
		return fmt.Errorf("invalid value of stat-cache-capacity (%v), can't be less than 0", c.DeprecatedStatCacheCapacity)
	}

	return nil
}