[#1770] engine: Support configuration reload
Currently, it only supports changing the compound of the shards. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
91b56ad3e8
commit
fbd5bc8c38
5 changed files with 287 additions and 1 deletions
|
@ -78,6 +78,10 @@ const notificationHandlerPoolSize = 10
|
|||
// structs).
|
||||
// It must not be used concurrently.
|
||||
type applicationConfiguration struct {
|
||||
// _read indicated whether a config
|
||||
// has already been read
|
||||
_read bool
|
||||
|
||||
EngineCfg struct {
|
||||
errorThreshold uint32
|
||||
shardPoolSize uint32
|
||||
|
@ -144,6 +148,14 @@ type subStorageCfg struct {
|
|||
// readConfig fills applicationConfiguration with raw configuration values
|
||||
// not modifying them.
|
||||
func (a *applicationConfiguration) readConfig(c *config.Config) error {
|
||||
if a._read {
|
||||
// clear if it is rereading
|
||||
*a = applicationConfiguration{}
|
||||
} else {
|
||||
// update the status
|
||||
a._read = true
|
||||
}
|
||||
|
||||
a.EngineCfg.errorThreshold = engineconfig.ShardErrorThreshold(c)
|
||||
a.EngineCfg.shardPoolSize = engineconfig.ShardPoolSize(c)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue