forked from TrueCloudLab/frostfs-node
[#1696] qos: Fix internal tag adjust
If request has no tag, but request's public key is netmap node's key or one of allowed internal tag keys from config, then request must use internal IO tag. Change-Id: Iff93b626941a81b088d8999b3f2947f9501dcdf8 Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
3bbee1b554
commit
632bd8e38d
5 changed files with 298 additions and 47 deletions
36
pkg/util/testing/netmap_source.go
Normal file
36
pkg/util/testing/netmap_source.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package testing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
|
||||
)
|
||||
|
||||
var (
|
||||
errInvalidDiff = errors.New("invalid diff")
|
||||
errNetmapNotFound = errors.New("netmap not found")
|
||||
)
|
||||
|
||||
type TestNetmapSource struct {
|
||||
Netmaps map[uint64]*netmap.NetMap
|
||||
CurrentEpoch uint64
|
||||
}
|
||||
|
||||
func (s *TestNetmapSource) GetNetMap(ctx context.Context, diff uint64) (*netmap.NetMap, error) {
|
||||
if diff >= s.CurrentEpoch {
|
||||
return nil, errInvalidDiff
|
||||
}
|
||||
return s.GetNetMapByEpoch(ctx, s.CurrentEpoch-diff)
|
||||
}
|
||||
|
||||
func (s *TestNetmapSource) GetNetMapByEpoch(_ context.Context, epoch uint64) (*netmap.NetMap, error) {
|
||||
if nm, found := s.Netmaps[epoch]; found {
|
||||
return nm, nil
|
||||
}
|
||||
return nil, errNetmapNotFound
|
||||
}
|
||||
|
||||
func (s *TestNetmapSource) Epoch(context.Context) (uint64, error) {
|
||||
return s.CurrentEpoch, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue