forked from TrueCloudLab/frostfs-node
27 lines
883 B
Go
27 lines
883 B
Go
package containerconfig
|
|
|
|
import "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
|
|
|
|
const (
|
|
subsection = "container"
|
|
listStreamSubsection = "list_stream"
|
|
|
|
// ContainerBatchSizeDefault represents the maximum amount of containers to send via stream at once.
|
|
ContainerBatchSizeDefault = 1000
|
|
)
|
|
|
|
// ContainerBatchSize returns the value of "batch_size" config parameter
|
|
// from "list_stream" subsection of "container" section.
|
|
//
|
|
// Returns ContainerBatchSizeDefault if the value is missing or if
|
|
// the value is not positive integer.
|
|
func ContainerBatchSize(c *config.Config) uint32 {
|
|
if c.Sub(subsection).Sub(listStreamSubsection).Value("batch_size") == nil {
|
|
return ContainerBatchSizeDefault
|
|
}
|
|
size := config.Uint32Safe(c.Sub(subsection).Sub(listStreamSubsection), "batch_size")
|
|
if size == 0 {
|
|
return ContainerBatchSizeDefault
|
|
}
|
|
return size
|
|
}
|