Documentation ¶
Index ¶
- Constants
- Variables
- func NewLevelQos(threshold *Threshold, diskStat iostat.IOViewer) *levelQos
- type Config
- type IOQos
- func (qos *IOQos) GetLevelMgr() LevelGetter
- func (qos *IOQos) Reader(ctx context.Context, ioType bnapi.IOType, reader io.Reader) (r io.Reader)
- func (qos *IOQos) ReaderAt(ctx context.Context, ioType bnapi.IOType, reader io.ReaderAt) (r io.ReaderAt)
- func (qos *IOQos) Writer(ctx context.Context, ioType bnapi.IOType, writer io.Writer) (w io.Writer)
- func (qos *IOQos) WriterAt(ctx context.Context, ioType bnapi.IOType, writer io.WriterAt) (w io.WriterAt)
- type LevelConfig
- type LevelGetter
- type LevelManager
- type LevelQos
- type ParaConfig
- type Qos
- type Threshold
Constants ¶
View Source
const ( MaxIops = 1000 * 1000 // 1000k MaxBandwidth = 2 << 30 // 1GB/s )
Variables ¶
View Source
var ErrWrongConfig = errors.New("qos: wrong config item")
Functions ¶
func NewLevelQos ¶
Types ¶
type Config ¶
type Config struct { DiskBandwidthMBPS int64 `json:"disk_bandwidth_MBPS"` DiskIOPS int64 `json:"disk_iops"` LevelConfigs LevelConfig `json:"flow_conf"` DiskViewer iostat.IOViewer `json:"-"` StatGetter flow.StatGetter `json:"-"` }
type IOQos ¶
type IOQos struct { LevelMgr LevelGetter // Identify: a level qos controller StatMgr flow.StatGetter // Identify: a io flow }
func (*IOQos) GetLevelMgr ¶
func (qos *IOQos) GetLevelMgr() LevelGetter
type LevelConfig ¶
type LevelConfig map[string]ParaConfig
type LevelGetter ¶
type LevelManager ¶
type LevelManager struct {
// contains filtered or unexported fields
}
Manage multiple level qos controllers Note: controllers that are not configured, nil
func NewLevelQosMgr ¶
func NewLevelQosMgr(conf Config, diskStat iostat.IOViewer) (*LevelManager, error)
type LevelQos ¶
type LevelQos interface { Writer(ctx context.Context, underlying io.Writer) io.Writer WriterAt(ctx context.Context, underlying io.WriterAt) io.WriterAt Reader(ctx context.Context, underlying io.Reader) io.Reader ReaderAt(ctx context.Context, underlying io.ReaderAt) io.ReaderAt ChangeLevelQos(level string, conf Config) }
qos controller. controlling two dimensions: - iopsLimiter - bpsLimiter
type ParaConfig ¶
type ParaConfig struct { Iops int64 `json:"iops"` Bandwidth int64 `json:"bandwidth_MBPS"` Factor float64 `json:"factor"` }
func InitAndFixParaConfig ¶
func InitAndFixParaConfig(raw ParaConfig) (para ParaConfig, err error)
type Qos ¶
type Qos interface { ReaderAt(context.Context, bnapi.IOType, io.ReaderAt) io.ReaderAt WriterAt(context.Context, bnapi.IOType, io.WriterAt) io.WriterAt Writer(context.Context, bnapi.IOType, io.Writer) io.Writer Reader(context.Context, bnapi.IOType, io.Reader) io.Reader GetLevelMgr() LevelGetter }
func NewQosManager ¶
Click to show internal directories.
Click to hide internal directories.