mirror of
https://github.com/minio/minio.git
synced 2025-02-26 04:49:16 -05:00
rename object_size -> block_size for cache subsystem (#18694)
This commit is contained in:
parent
4550535cbb
commit
eba23bbac4
@ -223,7 +223,7 @@ func initHelp() {
|
|||||||
config.HelpKV{
|
config.HelpKV{
|
||||||
Key: config.CacheSubSys,
|
Key: config.CacheSubSys,
|
||||||
Type: "string",
|
Type: "string",
|
||||||
Description: "enable various cache optimizations on MinIO for reads",
|
Description: "enable cache plugin on MinIO for GET/HEAD requests",
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
28
internal/config/cache/cache.go
vendored
28
internal/config/cache/cache.go
vendored
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2015-2022 MinIO, Inc.
|
// Copyright (c) 2015-2023 MinIO, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of MinIO Object Storage stack
|
// This file is part of MinIO Object Storage stack
|
||||||
//
|
//
|
||||||
@ -35,13 +35,13 @@ import (
|
|||||||
|
|
||||||
// Cache related keys
|
// Cache related keys
|
||||||
const (
|
const (
|
||||||
Enable = "enable"
|
Enable = "enable"
|
||||||
Endpoint = "endpoint"
|
Endpoint = "endpoint"
|
||||||
ObjectSize = "object_size"
|
BlockSize = "block_size"
|
||||||
|
|
||||||
EnvEnable = "MINIO_CACHE_ENABLE"
|
EnvEnable = "MINIO_CACHE_ENABLE"
|
||||||
EnvEndpoint = "MINIO_CACHE_ENDPOINT"
|
EnvEndpoint = "MINIO_CACHE_ENDPOINT"
|
||||||
EnvObjectSize = "MINIO_CACHE_OBJECT_SIZE"
|
EnvBlockSize = "MINIO_CACHE_BLOCK_SIZE"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultKVS - default KV config for cache settings
|
// DefaultKVS - default KV config for cache settings
|
||||||
@ -55,7 +55,7 @@ var DefaultKVS = config.KVS{
|
|||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
config.KV{
|
config.KV{
|
||||||
Key: ObjectSize,
|
Key: BlockSize,
|
||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -70,9 +70,9 @@ type Config struct {
|
|||||||
// Etag and ModTime of an object + version
|
// Etag and ModTime of an object + version
|
||||||
Endpoint string `json:"endpoint"`
|
Endpoint string `json:"endpoint"`
|
||||||
|
|
||||||
// ObjectSize indicates the maximum object size below which
|
// BlockSize indicates the maximum object size below which
|
||||||
// data is cached and fetched remotely from DRAM.
|
// data is cached and fetched remotely from DRAM.
|
||||||
ObjectSize int64
|
BlockSize int64
|
||||||
|
|
||||||
// Is the HTTP client used for communicating with mcache server
|
// Is the HTTP client used for communicating with mcache server
|
||||||
clnt *http.Client
|
clnt *http.Client
|
||||||
@ -90,7 +90,7 @@ func (c Config) MatchesSize(size int64) bool {
|
|||||||
configLock.RLock()
|
configLock.RLock()
|
||||||
defer configLock.RUnlock()
|
defer configLock.RUnlock()
|
||||||
|
|
||||||
return c.Enable && c.ObjectSize > 0 && size <= c.ObjectSize
|
return c.Enable && c.BlockSize > 0 && size <= c.BlockSize
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates new cache frequency
|
// Update updates new cache frequency
|
||||||
@ -100,7 +100,7 @@ func (c *Config) Update(ncfg Config) {
|
|||||||
|
|
||||||
c.Enable = ncfg.Enable
|
c.Enable = ncfg.Enable
|
||||||
c.Endpoint = ncfg.Endpoint
|
c.Endpoint = ncfg.Endpoint
|
||||||
c.ObjectSize = ncfg.ObjectSize
|
c.BlockSize = ncfg.BlockSize
|
||||||
c.clnt = ncfg.clnt
|
c.clnt = ncfg.clnt
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,12 +223,12 @@ func (c Config) Delete(bucket, key string) {
|
|||||||
func LookupConfig(kvs config.KVS, transport http.RoundTripper) (cfg Config, err error) {
|
func LookupConfig(kvs config.KVS, transport http.RoundTripper) (cfg Config, err error) {
|
||||||
cfg.Enable = env.Get(EnvEnable, kvs.GetWithDefault(Enable, DefaultKVS)) == config.EnableOn
|
cfg.Enable = env.Get(EnvEnable, kvs.GetWithDefault(Enable, DefaultKVS)) == config.EnableOn
|
||||||
|
|
||||||
if d := env.Get(EnvObjectSize, kvs.GetWithDefault(ObjectSize, DefaultKVS)); d != "" {
|
if d := env.Get(EnvBlockSize, kvs.GetWithDefault(BlockSize, DefaultKVS)); d != "" {
|
||||||
objectSize, err := humanize.ParseBytes(d)
|
objectSize, err := humanize.ParseBytes(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cfg, err
|
return cfg, err
|
||||||
}
|
}
|
||||||
cfg.ObjectSize = int64(objectSize)
|
cfg.BlockSize = int64(objectSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.Endpoint = env.Get(EnvEndpoint, kvs.GetWithDefault(Endpoint, DefaultKVS))
|
cfg.Endpoint = env.Get(EnvEndpoint, kvs.GetWithDefault(Endpoint, DefaultKVS))
|
||||||
|
8
internal/config/cache/help.go
vendored
8
internal/config/cache/help.go
vendored
@ -29,19 +29,19 @@ var (
|
|||||||
config.HelpKV{
|
config.HelpKV{
|
||||||
Key: Enable,
|
Key: Enable,
|
||||||
Type: "on|off",
|
Type: "on|off",
|
||||||
Description: "set to enable various caching optimizations" + defaultHelpPostfix(Enable),
|
Description: "set to enable remote cache plugin" + defaultHelpPostfix(Enable),
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
config.HelpKV{
|
config.HelpKV{
|
||||||
Key: Endpoint,
|
Key: Endpoint,
|
||||||
Type: "string",
|
Type: "string",
|
||||||
Description: "remote endpoint where MinIO will cache GET/HEAD metadata values such as ETag, ModTime" + defaultHelpPostfix(Endpoint),
|
Description: "remote cache endpoint for GET/HEAD object(s) metadata, data" + defaultHelpPostfix(Endpoint),
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
config.HelpKV{
|
config.HelpKV{
|
||||||
Key: ObjectSize,
|
Key: BlockSize,
|
||||||
Type: "string",
|
Type: "string",
|
||||||
Description: "maximum object size below which data is cached and fetched remotely from DRAM if possible" + defaultHelpPostfix(ObjectSize),
|
Description: "cache all objects below the specified block size" + defaultHelpPostfix(BlockSize),
|
||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user