cubefs

Форк
0
/
s3qos.go 
53 строки · 1.5 Кб
1
// Copyright 2023 The CubeFS Authors.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
// implied. See the License for the specific language governing
13
// permissions and limitations under the License.
14

15
package proto
16

17
import "strings"
18

19
const (
20
	FlowLimit       = "f"
21
	QPSLimit        = "q"
22
	ConcurrentLimit = "c"
23
	S3Nodes         = "s3nodes"
24
	DefaultUid      = "default"
25
)
26

27
type UserLimitConf struct {
28
	BandWidthQuota  map[string]uint64 `json:"band_width_quota"` // uid --> BytesPS
29
	QPSQuota        map[string]uint64 `json:"qps_quota"`        // uid --> QPS
30
	ConcurrentQuota map[string]uint64 `json:"concurrent_quota"` // uid --> concurrency
31
}
32

33
type S3QosRequest struct {
34
	Uid   string `json:"uid"`
35
	Api   string `json:"api"`
36
	Type  string `json:"type"`
37
	Quota uint64 `json:"quota"`
38
	Nodes uint64 `json:"nodes"`
39
}
40

41
type S3QoSResponse struct {
42
	ApiLimitConf map[string]*UserLimitConf `json:"user_limit_conf"` // api --> userLimitConf
43
	Nodes        uint64                    `json:"nodes"`
44
}
45

46
func IsS3PutApi(api string) bool {
47
	switch strings.ToLower(api) {
48
	case "putobject", "copyobject", "uploadpart", "uploadpartcopy", "postobject":
49
		return true
50
	default:
51
		return false
52
	}
53
}
54

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.