frostfs-node/pkg/innerring/processors/frostfs/process_config.go
Dmitrii Stepanov 7429553266
[#1437] node: Fix contextcheck linter
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2024-11-13 10:36:10 +03:00

34 lines
898 B
Go

package frostfs
import (
"context"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
nmClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap"
frostfsEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/frostfs"
"go.uber.org/zap"
)
// Process config event by setting configuration value from the mainchain in
// the sidechain.
func (np *Processor) processConfig(ctx context.Context, config frostfsEvent.Config) bool {
if !np.alphabetState.IsAlphabet(ctx) {
np.log.Info(ctx, logs.FrostFSNonAlphabetModeIgnoreConfig)
return true
}
prm := nmClient.SetConfigPrm{}
prm.SetID(config.ID())
prm.SetKey(config.Key())
prm.SetValue(config.Value())
prm.SetHash(config.TxHash())
err := np.netmapClient.SetConfig(ctx, prm)
if err != nil {
np.log.Error(ctx, logs.FrostFSCantRelaySetConfigEvent, zap.Error(err))
return false
}
return true
}