-
Notifications
You must be signed in to change notification settings - Fork 1
/
field_array_pool_config.gen.go
41 lines (34 loc) · 1.28 KB
/
field_array_pool_config.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// This file was automatically generated by genny.
// Any changes will be lost if this file is regenerated.
// see https://github.com/mauricelam/genny
package field
import (
"github.com/m3db/m3/src/x/instrument"
)
// FieldArrayPoolWatermarkConfiguration contains watermark configuration for pools.
type FieldArrayPoolWatermarkConfiguration struct {
// The low watermark to start refilling the pool, if zero none.
RefillLowWatermark float64 `yaml:"low" validate:"min=0.0,max=1.0"`
// The high watermark to stop refilling the pool, if zero none.
RefillHighWatermark float64 `yaml:"high" validate:"min=0.0,max=1.0"`
}
// FieldArrayPoolConfiguration contains pool configuration.
type FieldArrayPoolConfiguration struct {
// The size of the pool.
Size *int `yaml:"size"`
// The watermark configuration.
Watermark FieldArrayPoolWatermarkConfiguration `yaml:"watermark"`
}
// NewPoolOptions creates a new set of pool options.
func (c *FieldArrayPoolConfiguration) NewPoolOptions(
instrumentOpts instrument.Options,
) *FieldArrayPoolOptions {
opts := NewFieldArrayPoolOptions().
SetInstrumentOptions(instrumentOpts).
SetRefillLowWatermark(c.Watermark.RefillLowWatermark).
SetRefillHighWatermark(c.Watermark.RefillHighWatermark)
if c.Size != nil {
opts = opts.SetSize(*c.Size)
}
return opts
}