hospitality

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetByRequest

func GetByRequest(request *restful.Request, response *restful.Response)

GetByRequest returns hospitality score by request

func Register

func Register(prefix string, container *restful.Container)

Register add handlers for /v1/hospitality endpoint

Types

type CacheScore

type CacheScore map[string]uint32

CacheScore represents the score on specific cache id

type Hospitality

type Hospitality struct {
	SC map[string]CacheScore `json:"score"`
}

Hospitality represents the score of the host

{
	"score": {
		"l3": {
			"0": 30
			"1": 30
		}
	}
}

func (*Hospitality) GetByRequest

func (h *Hospitality) GetByRequest(req *Request) error

GetByRequest returns hospitality score by request

func (*Hospitality) GetByRequestMaxMin

func (h *Hospitality) GetByRequestMaxMin(max, min uint32, cacheIDuint *uint32, targetLev string) error

GetByRequestMaxMin constructs Hospitality struct by max and min cache ways

type Request

type Request struct {
	MaxCache uint32  `json:"max_cache,omitempty"`
	MinCache uint32  `json:"min_cache,omitempty"`
	Policy   string  `json:"policy,omitempty"`
	CacheID  *uint32 `json:"cache_id,omitempty"`
}

Request represents the hospitality request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL