You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
529 B
22 lines
529 B
6 years ago
|
package blademaster
|
||
|
|
||
|
import (
|
||
|
criticalityPkg "github.com/bilibili/kratos/pkg/net/criticality"
|
||
|
"github.com/bilibili/kratos/pkg/net/metadata"
|
||
|
|
||
|
"github.com/pkg/errors"
|
||
|
)
|
||
|
|
||
|
// Criticality is
|
||
|
func Criticality(pathCriticality criticalityPkg.Criticality) HandlerFunc {
|
||
|
if !criticalityPkg.Exist(pathCriticality) {
|
||
|
panic(errors.Errorf("This criticality is not exist: %s", pathCriticality))
|
||
|
}
|
||
|
return func(ctx *Context) {
|
||
|
md, ok := metadata.FromContext(ctx)
|
||
|
if ok {
|
||
|
md[metadata.Criticality] = string(pathCriticality)
|
||
|
}
|
||
|
}
|
||
|
}
|