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