forked from TrueCloudLab/frostfs-node
config: replace use_write_cache
with writecache.enabled
This is the way things are done with `grpc.tls` and in neo-go. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
20b3ff84b3
commit
e976a55358
9 changed files with 22 additions and 27 deletions
|
@ -55,7 +55,7 @@ func TestEngineSection(t *testing.T) {
|
|||
|
||||
switch num {
|
||||
case 0:
|
||||
require.Equal(t, false, sc.UseWriteCache())
|
||||
require.Equal(t, false, wc.Enabled())
|
||||
|
||||
require.Equal(t, "tmp/0/cache", wc.Path())
|
||||
require.EqualValues(t, 2147483648, wc.MemSize())
|
||||
|
@ -85,7 +85,7 @@ func TestEngineSection(t *testing.T) {
|
|||
require.Equal(t, false, sc.RefillMetabase())
|
||||
require.Equal(t, shard.ModeReadOnly, sc.Mode())
|
||||
case 1:
|
||||
require.Equal(t, true, sc.UseWriteCache())
|
||||
require.Equal(t, true, wc.Enabled())
|
||||
|
||||
require.Equal(t, "tmp/1/cache", wc.Path())
|
||||
require.EqualValues(t, 2147483648, wc.MemSize())
|
||||
|
|
|
@ -20,16 +20,6 @@ func From(c *config.Config) *Config {
|
|||
return (*Config)(c)
|
||||
}
|
||||
|
||||
// UseWriteCache returns value of "use_write_cache" config parameter.
|
||||
//
|
||||
// Panics if value is not a valid bool.
|
||||
func (x *Config) UseWriteCache() bool {
|
||||
return config.Bool(
|
||||
(*config.Config)(x),
|
||||
"use_write_cache",
|
||||
)
|
||||
}
|
||||
|
||||
// BlobStor returns "blobstor" subsection as a blobstorconfig.Config.
|
||||
func (x *Config) BlobStor() *blobstorconfig.Config {
|
||||
return blobstorconfig.From(
|
||||
|
|
|
@ -31,6 +31,13 @@ func From(c *config.Config) *Config {
|
|||
return (*Config)(c)
|
||||
}
|
||||
|
||||
// Enabled returns true if write-cache is enabled and false otherwise.
|
||||
//
|
||||
// Panics if value is not a boolean.
|
||||
func (x *Config) Enabled() bool {
|
||||
return config.Bool((*config.Config)(x), "enabled")
|
||||
}
|
||||
|
||||
// Path returns value of "path" config parameter.
|
||||
//
|
||||
// Panics if value is not a non-empty string.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue