2022-12-23 20:35:35 +03:00
|
|
|
package frostfs
|
2020-09-08 12:01:38 +03:00
|
|
|
|
|
|
|
import (
|
2023-04-12 17:35:10 +03:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
2023-03-07 16:38:26 +03:00
|
|
|
nmClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap"
|
|
|
|
frostfsEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/frostfs"
|
2020-09-08 12:01:38 +03:00
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
2022-04-21 14:28:05 +03:00
|
|
|
// Process config event by setting configuration value from the mainchain in
|
|
|
|
// the sidechain.
|
2023-05-26 13:24:41 +03:00
|
|
|
func (np *Processor) processConfig(config frostfsEvent.Config) bool {
|
2021-03-23 18:20:44 +03:00
|
|
|
if !np.alphabetState.IsAlphabet() {
|
2023-04-12 17:35:10 +03:00
|
|
|
np.log.Info(logs.FrostFSNonAlphabetModeIgnoreConfig)
|
2023-05-26 13:24:41 +03:00
|
|
|
return true
|
2020-09-08 12:01:38 +03:00
|
|
|
}
|
|
|
|
|
2022-01-31 14:58:55 +03:00
|
|
|
prm := nmClient.SetConfigPrm{}
|
2021-11-10 14:05:51 +03:00
|
|
|
|
|
|
|
prm.SetID(config.ID())
|
|
|
|
prm.SetKey(config.Key())
|
|
|
|
prm.SetValue(config.Value())
|
|
|
|
prm.SetHash(config.TxHash())
|
|
|
|
|
|
|
|
err := np.netmapClient.SetConfig(prm)
|
2020-09-08 12:01:38 +03:00
|
|
|
if err != nil {
|
2023-04-12 17:35:10 +03:00
|
|
|
np.log.Error(logs.FrostFSCantRelaySetConfigEvent, zap.Error(err))
|
2023-05-26 13:24:41 +03:00
|
|
|
return false
|
2020-09-08 12:01:38 +03:00
|
|
|
}
|
2023-05-26 13:24:41 +03:00
|
|
|
|
|
|
|
return true
|
2020-09-08 12:01:38 +03:00
|
|
|
}
|