37 Star 411 Fork 76

GVPrancher/rancher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
proxy_store.go 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
Darren Shepherd 提交于 2018-04-26 15:02 . Move watch sharing to norman
package userstored
import (
"context"
"strings"
"github.com/rancher/norman/store/proxy"
"github.com/rancher/norman/types"
clusterSchema "github.com/rancher/types/apis/cluster.cattle.io/v3/schema"
"github.com/rancher/types/apis/project.cattle.io/v3/schema"
"github.com/rancher/types/config"
)
type storeWrapperFunc func(types.Store) types.Store
func addProxyStore(ctx context.Context, schemas *types.Schemas, context *config.ScaledContext, schemaType, apiVersion string, storeWrapper storeWrapperFunc) *types.Schema {
s := schemas.Schema(&schema.Version, schemaType)
if s == nil {
s = schemas.Schema(&clusterSchema.Version, schemaType)
}
if s == nil {
panic("Failed to find schema " + schemaType)
}
prefix := []string{"api"}
group := ""
version := "v1"
kind := s.CodeName
plural := s.PluralName
parts := strings.SplitN(apiVersion, "/", 2)
if len(parts) == 1 {
version = parts[0]
} else {
group = parts[0]
version = parts[1]
prefix = []string{"apis"}
}
s.Store = proxy.NewProxyStore(ctx, context.ClientGetter,
config.UserStorageContext,
prefix,
group,
version,
kind,
plural)
if storeWrapper != nil {
s.Store = storeWrapper(s.Store)
}
return s
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/rancher/rancher.git
git@gitee.com:rancher/rancher.git
rancher
rancher
rancher
v2.2.2-rc7

搜索帮助

0d507c66 1850385 C8b1a773 1850385