All checks were successful
DCO action / DCO (pull_request) Successful in 44s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m52s
Vulncheck / Vulncheck (pull_request) Successful in 1m31s
Tests and linters / Run gofumpt (pull_request) Successful in 1m37s
Build / Build Components (pull_request) Successful in 1m54s
Tests and linters / gopls check (pull_request) Successful in 2m30s
Tests and linters / Staticcheck (pull_request) Successful in 2m21s
Tests and linters / Tests (pull_request) Successful in 2m32s
Tests and linters / Lint (pull_request) Successful in 3m4s
Tests and linters / Tests with -race (pull_request) Successful in 4m17s
Tests and linters / Run gofumpt (push) Successful in 1m25s
Vulncheck / Vulncheck (push) Successful in 1m35s
Pre-commit hooks / Pre-commit (push) Successful in 1m53s
Build / Build Components (push) Successful in 1m56s
Tests and linters / Tests (push) Successful in 2m6s
Tests and linters / Staticcheck (push) Successful in 2m15s
Tests and linters / gopls check (push) Successful in 2m30s
Tests and linters / Tests with -race (push) Successful in 2m44s
Tests and linters / Lint (push) Successful in 3m1s
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
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
|
|
}
|