forked from TrueCloudLab/frostfs-node
[#1475] Remove container estimation code
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
7edec9193c
commit
c8fb154151
13 changed files with 9 additions and 499 deletions
|
@ -3,14 +3,10 @@ package innerring
|
|||
import (
|
||||
"context"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors/alphabet"
|
||||
timerEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/timers"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/container"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/timer"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -19,28 +15,12 @@ type (
|
|||
EpochDuration() uint64
|
||||
}
|
||||
|
||||
alphaState interface {
|
||||
IsAlphabet() bool
|
||||
}
|
||||
|
||||
newEpochHandler func()
|
||||
|
||||
containerEstimationStopper interface {
|
||||
StopEstimation(p container.StopEstimationPrm) error
|
||||
}
|
||||
|
||||
epochTimerArgs struct {
|
||||
l *logger.Logger
|
||||
|
||||
alphabetState alphaState
|
||||
|
||||
newEpochHandlers []newEpochHandler
|
||||
|
||||
cnrWrapper containerEstimationStopper // to invoke stop container estimation
|
||||
epoch epochState // to specify which epoch to stop, and epoch duration
|
||||
|
||||
stopEstimationDMul uint32 // X: X/Y of epoch in blocks
|
||||
stopEstimationDDiv uint32 // Y: X/Y of epoch in blocks
|
||||
epoch epochState // to specify which epoch to stop, and epoch duration
|
||||
}
|
||||
|
||||
emitTimerArgs struct {
|
||||
|
@ -74,7 +54,7 @@ func (s *Server) tickTimers(h uint32) {
|
|||
}
|
||||
|
||||
func newEpochTimer(args *epochTimerArgs) *timer.BlockTimer {
|
||||
epochTimer := timer.NewBlockTimer(
|
||||
return timer.NewBlockTimer(
|
||||
func() (uint32, error) {
|
||||
return uint32(args.epoch.EpochDuration()), nil
|
||||
},
|
||||
|
@ -84,35 +64,6 @@ func newEpochTimer(args *epochTimerArgs) *timer.BlockTimer {
|
|||
}
|
||||
},
|
||||
)
|
||||
|
||||
// sub-timer for epoch timer to tick stop container estimation events at
|
||||
// some block in epoch
|
||||
epochTimer.OnDelta(
|
||||
args.stopEstimationDMul,
|
||||
args.stopEstimationDDiv,
|
||||
func() {
|
||||
if !args.alphabetState.IsAlphabet() {
|
||||
args.l.Debug(logs.InnerringNonalphabetModeDoNotStopContainerEstimations)
|
||||
return
|
||||
}
|
||||
|
||||
epochN := args.epoch.EpochCounter()
|
||||
if epochN == 0 { // estimates are invalid in genesis epoch
|
||||
return
|
||||
}
|
||||
|
||||
prm := container.StopEstimationPrm{}
|
||||
prm.SetEpoch(epochN - 1)
|
||||
|
||||
err := args.cnrWrapper.StopEstimation(prm)
|
||||
if err != nil {
|
||||
args.l.Warn(logs.InnerringCantStopEpochEstimation,
|
||||
zap.Uint64("epoch", epochN),
|
||||
zap.String("error", err.Error()))
|
||||
}
|
||||
})
|
||||
|
||||
return epochTimer
|
||||
}
|
||||
|
||||
func newEmissionTimer(args *emitTimerArgs) *timer.BlockTimer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue