2022-12-23 17:35:35 +00:00
|
|
|
package frostfs
|
2020-09-08 09:01:38 +00:00
|
|
|
|
|
|
|
import (
|
2024-10-21 07:22:54 +00:00
|
|
|
"context"
|
|
|
|
|
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.
|
2024-10-21 13:27:28 +00:00
|
|
|
func (np *Processor) processConfig(ctx context.Context, config frostfsEvent.Config) bool {
|
|
|
|
if !np.alphabetState.IsAlphabet(ctx) {
|
|
|
|
np.log.Info(ctx, 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())
|
|
|
|
|
2024-10-21 13:27:28 +00:00
|
|
|
err := np.netmapClient.SetConfig(ctx, prm)
|
2020-09-08 09:01:38 +00:00
|
|
|
if err != nil {
|
2024-10-21 13:27:28 +00:00
|
|
|
np.log.Error(ctx, 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
|
|
|
}
|