forked from TrueCloudLab/frostfs-node
[#493] cmd/node: Add object service section to config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
f40b84c99e
commit
cd947bb580
5 changed files with 83 additions and 0 deletions
41
cmd/neofs-node/config/object/config.go
Normal file
41
cmd/neofs-node/config/object/config.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package objectconfig
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
||||
)
|
||||
|
||||
// PutConfig is a wrapper over "put" config section which provides access
|
||||
// to object put pipeline configuration of object service.
|
||||
type PutConfig struct {
|
||||
cfg *config.Config
|
||||
}
|
||||
|
||||
const (
|
||||
subsection = "object"
|
||||
|
||||
putSubsection = "put"
|
||||
|
||||
// PutPoolSizeDefault is a default value of routine pool size to
|
||||
// process object.Put requests in object service.
|
||||
PutPoolSizeDefault = 10
|
||||
)
|
||||
|
||||
// Put returns structure that provides access to "put" subsection of
|
||||
// "object" section.
|
||||
func Put(c *config.Config) PutConfig {
|
||||
return PutConfig{
|
||||
c.Sub(subsection).Sub(putSubsection),
|
||||
}
|
||||
}
|
||||
|
||||
// PoolSize returns value of "pool_size" config parameter.
|
||||
//
|
||||
// Returns PutPoolSizeDefault if value is not positive number.
|
||||
func (g PutConfig) PoolSize() int {
|
||||
v := config.Int(g.cfg, "pool_size")
|
||||
if v > 0 {
|
||||
return int(v)
|
||||
}
|
||||
|
||||
return PutPoolSizeDefault
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue