Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config[PT item[T], T any] struct { // CreateFunc is used to create pool item. // Timeout is not set as context.WithTimeout // because this is running context for long-lived item. // Timeout itself should limit only creation steps, // and it is responsibility of CreateFunc to handle it appropriately. CreateFunc func(ctx context.Context, createTimeout time.Duration) (PT, error) Logger logger.Logger // CreateTimeout limits runtime for CreateFunc. // This timeout cannot be less than a second (minCreateTimeout). // Default is 3 seconds (defaultCreateTimeout). CreateTimeout time.Duration // Lifetime specifies item lifetime after which it will be closed // and new item will be created instead. // 0 lifetime means item has infinite lifetime and item recycling // is not running. // Lifetime cannot be less than 5 seconds (minItemLifetime). Lifetime time.Duration // RecycleWindow specifies time interval for item recycling: // [Lifetime-RecycleWindow;Lifetime+RecycleWindow] // This prevents service degradation caused by recycling of // significant number of items created at the same time. RecycleWindow time.Duration // PoolSize specifies amount of items in pool. PoolSize uint // Ready thresholds specifies transition points (in percents) for ready status. // If amount of inUse + idle sessions is greater or equal than // high threshold then pool is Ready. // If this amount is equal or less than low threshold then pool is NotReady. // Thresholds should be in range [0;100] and satisfy lo < hi condition // (must not be equal!). If these conditions are not met, pool will fall back // to default lo=0, hi=50 values. ReadyThresholdPercentHigh uint ReadyThresholdPercentLow uint // contains filtered or unexported fields }
Config holds pool configuration.
Click to show internal directories.
Click to hide internal directories.