-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.go
36 lines (29 loc) · 940 Bytes
/
config.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
/*
* Copyright (c) New Cloud Technologies, Ltd. 2013-2022.
* Author: Vitaly Isaev <[email protected]>
* License: https://github.com/newcloudtechnologies/memlimiter/blob/master/LICENSE
*/
package memlimiter
import (
"github.com/pkg/errors"
"github.com/newcloudtechnologies/memlimiter/controller/nextgc"
)
// Config - high-level MemLimiter config.
type Config struct {
// ControllerNextGC - NextGC-based controller
ControllerNextGC *nextgc.ControllerConfig `json:"controller_nextgc"` //nolint:tagliatelle
// TODO:
// if new controller implementation appears, put its config here and make switch in Prepare()
// (only one subsection must be not nil).
}
// Prepare validates config.
func (c *Config) Prepare() error {
if c == nil {
// This means that user wants to use stub instead of real memlimiter
return nil
}
if c.ControllerNextGC == nil {
return errors.New("empty ControllerNextGC")
}
return nil
}