MCPcopy Create free account
hub / github.com/devld/go-drive / validateVMPoolConfig

Function validateVMPoolConfig

script/pool.go:59–78  ·  view source on GitHub ↗
(config *VMPoolConfig)

Source from the content-addressed store, hash-verified

57}
58
59func validateVMPoolConfig(config *VMPoolConfig) {
60 if config == nil {
61 panic("VM pool config is required")
62 }
63 if config.MaxTotal <= 0 {
64 panic("MaxTotal must be greater than zero")
65 }
66 if config.MaxIdle < 0 {
67 panic("MaxIdle must not be negative")
68 }
69 if config.MinIdle < 0 {
70 panic("MinIdle must not be negative")
71 }
72 if config.MaxIdle < config.MinIdle {
73 panic("MaxIdle must be greater than or equal to MinIdle")
74 }
75 if config.MaxTotal < config.MinIdle {
76 panic("MaxTotal must be greater than or equal to MinIdle")
77 }
78}
79
80func cleanPeriod(idleTime time.Duration) time.Duration {
81 period := idleTime / 2

Callers 1

NewVMPoolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected