model

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 23 Imported by: 18

Documentation

Index

Constants

View Source
const (
	OperatorRoleKey       string = "operator_role"
	OperatorPrincipalType string = "operator_principal"
	OperatorIDKey         string = "operator_id"
	OperatorOwnerKey      string = "operator_owner"
	OperatorLinkStrategy  string = "operator_link_strategy"
	LinkUsersKey          string = "link_users"
	LinkGroupsKey         string = "link_groups"
	RemoveLinkUsersKey    string = "remove_link_users"
	RemoveLinkGroupsKey   string = "remove_link_groups"

	TokenDetailInfoKey string = "TokenInfo"
	TokenForUser       string = "uid"
	TokenForUserGroup  string = "groupid"

	ResourceAttachmentKey string = "resource_attachment"
)
View Source
const (
	// ClientLabel_IP 客户端 IP
	ClientLabel_IP = "CLIENT_IP"
	// ClientLabel_ID 客户端 ID
	ClientLabel_ID = "CLIENT_ID"
	// ClientLabel_Version 客户端版本
	ClientLabel_Version = "CLIENT_VERSION"
	// ClientLabel_Language 客户端语言
	ClientLabel_Language = "CLIENT_LANGUAGE"
)
View Source
const (
	// ReleaseTypeFull 全量类型
	ReleaseTypeFull = ""
	// ReleaseTypeGray 灰度类型
	ReleaseTypeGray = "gray"
)
View Source
const (
	// MetaKeyPolarisService service identifier by self registration
	MetaKeyPolarisService = "polaris_service"

	// MetaKeyBuildRevision build revision for server
	MetaKeyBuildRevision = "build-revision"
)
View Source
const (
	// MetaKeyConfigFileUseEncrypted 配置加密开关标识,value 为 boolean
	MetaKeyConfigFileUseEncrypted = "internal-encrypted"
	// MetaKeyConfigFileDataKey 加密密钥 tag key
	MetaKeyConfigFileDataKey = "internal-datakey"
	// MetaKeyConfigFileEncryptAlgo 加密算法 tag key
	MetaKeyConfigFileEncryptAlgo = "internal-encryptalgo"
	// MetaKeyConfigFileSyncToKubernetes 配置同步到 kubernetes
	MetaKeyConfigFileSyncToKubernetes = "internal-sync-to-kubernetes"
	// ---- 以下参数仅适配 polaris-controller 生态 ----
	// MetaKeyConfigFileSyncSourceKey 配置同步来源
	MetaKeyConfigFileSyncSourceKey = "internal-sync-source"
	// MetaKeyConfigFileSyncSourceClusterKey 配置同步来源所在集群
	MetaKeyConfigFileSyncSourceClusterKey = "internal-sync-sourcecluster"
)
View Source
const (
	MetadataInstanceLastHeartbeatTime   = "internal-lastheartbeat"
	MetadataServiceProtectThreshold     = "internal-service-protectthreshold"
	MetadataRegisterFrom                = "internal-register-from"
	MetadataInternalMetaHealthCheckPath = "internal-healthcheck_path"
	MetadataInternalMetaTraceSampling   = "internal-trace_sampling"
)
View Source
const (
	LabelKeyPath          = "$path"
	LabelKeyMethod        = "$method"
	LabelKeyHeader        = "$header"
	LabelKeyQuery         = "$query"
	LabelKeyCallerService = "$caller_service"
	LabelKeyCallerIP      = "$caller_ip"
)
View Source
const (
	// V2RuleIDKey v2 版本的规则路由 ID
	V2RuleIDKey = "__routing_v2_id__"
	// V1RuleIDKey v1 版本的路由规则 ID
	V1RuleIDKey = "__routing_v1_id__"
	// V1RuleRouteIndexKey v1 版本 route 规则在自己 route 链中的 index 信息
	V1RuleRouteIndexKey = "__routing_v1_route_index__"
	// V1RuleRouteTypeKey 标识当前 v2 路由规则在 v1 的 inBound 还是 outBound
	V1RuleRouteTypeKey = "__routing_v1_route_type__"
	// V1RuleInRoute inBound 类型
	V1RuleInRoute = "in"
	// V1RuleOutRoute outBound 类型
	V1RuleOutRoute = "out"
)
View Source
const CtxEventKeyMetadata = "ctx_event_metadata"

CtxEventKeyMetadata 用于将metadata从Context中传入并取出

View Source
const (

	// DefaultStrategySuffix 默认策略的名称前缀
	DefaultStrategySuffix string = "的默认策略"
)
View Source
const (
	MatchAll = "*"
)
View Source
const (
	StatReportPrometheus string = "prometheus"
)

Variables

View Source
var (
	// ErrorNoUser 没有找到对应的用户
	ErrorNoUser error = errors.New("no such user")

	// ErrorNoUserGroup 没有找到对应的用户组
	ErrorNoUserGroup error = errors.New("no such user group")

	// ErrorNoNamespace 没有找到对应的命名空间
	ErrorNoNamespace error = errors.New("no such namespace")

	// ErrorNoService 没有找到对应的服务
	ErrorNoService error = errors.New("no such service")

	// ErrorWrongUsernameOrPassword 用户或者密码错误
	ErrorWrongUsernameOrPassword error = errors.New("name or password is wrong")

	// ErrorTokenNotExist token 不存在
	ErrorTokenNotExist error = errors.New("token not exist")

	// ErrorTokenInvalid 非法的 token
	ErrorTokenInvalid error = errors.New("invalid token")

	// ErrorTokenDisabled token 已经被禁用
	ErrorTokenDisabled error = errors.New("token already disabled")
)
View Source
var (
	// RuleRoutingTypeUrl 记录 anypb.Any 中关于 RuleRoutingConfig 的 url 信息
	RuleRoutingTypeUrl string
	// MetaRoutingTypeUrl 记录 anypb.Any 中关于 MetadataRoutingConfig 的 url 信息
	MetaRoutingTypeUrl string
)
View Source
var (
	// PrincipalNames principal name map
	PrincipalNames = map[PrincipalType]string{
		PrincipalUser:  "user",
		PrincipalGroup: "group",
	}
)
View Source
var (
	UserRoleNames = map[UserRoleType]string{
		AdminUserRole:      "admin",
		OwnerUserRole:      "main",
		SubAccountUserRole: "sub",
	}
)
View Source
var WeightEnum = map[string]WeightType{
	"dynamic": WEIGHTDYNAMIC,
	"static":  WEIGHTSTATIC,
}

WeightEnum weight enum map

View Source
var WeightString = map[WeightType]string{
	WEIGHTDYNAMIC: "dynamic",
	WEIGHTSTATIC:  "static",
}

WeightString weight string map

Functions

func Arguments2Labels

func Arguments2Labels(arguments []*apitraffic.MatchArgument) map[string]*apimodel.MatchString

Arguments2Labels 将参数列表适配成旧的标签模型

func BuildArgumentKey added in v1.17.2

func BuildArgumentKey(argumentType apitraffic.MatchArgument_Type, key string) string

func BuildDefaultStrategyName

func BuildDefaultStrategyName(role PrincipalType, name string) string

BuildDefaultStrategyName 构建默认鉴权策略的名称信息

func BuildInBoundsFromV2 added in v1.17.2

func BuildInBoundsFromV2(service, namespace string, item *ExtendRouterConfig) []*apitraffic.Route

BuildInBoundsFromV2 Convert the routing rules of V2 to the inbounds in the routing rule of V1

func BuildKeyForClientConfigFileInfo added in v1.18.0

func BuildKeyForClientConfigFileInfo(info *config_manage.ClientConfigFileInfo) string

BuildKeyForClientConfigFileInfo 必须保证和 ConfigFileReleaseKey.FileKey 是一样的生成规则

func BuildOutBoundsFromV2 added in v1.17.2

func BuildOutBoundsFromV2(service, namespace string, item *ExtendRouterConfig) []*apitraffic.Route

BuildOutBoundsFromV2 According to the routing rules of the V2 version, it is adapted to the outbounds in the routing rule of V1 version

func BuildV1RoutesFromV2 added in v1.17.2

func BuildV1RoutesFromV2(service, namespace string,
	entries []*ExtendRouterConfig) ([]*apitraffic.Route, []*apitraffic.Route, []string)

BuildV1RoutesFromV2 According to the routing rules of the V2 version, it is adapted to the V1 version of the routing rules. return inBound outBound revisions

func BuildV2RoutingFromV1Route added in v1.17.2

func BuildV2RoutingFromV1Route(req *apitraffic.Routing, route *apitraffic.Route) (*apitraffic.RouteRule, error)

BuildV2RoutingFromV1Route Build a V2 version of API data object routing rules

func CheckPrincipalType

func CheckPrincipalType(role int) error

CheckPrincipalType 检查鉴权策略成员角色信息

func CompareRoutingV2 added in v1.17.2

func CompareRoutingV2(a, b *ExtendRouterConfig) bool

CompareRoutingV2 Compare the priority of two routing.

func CompositeRoutingV1AndV2 added in v1.17.2

func CompositeRoutingV1AndV2(v1rule *apitraffic.Routing, level1, level2,
	level3 []*ExtendRouterConfig) (*apitraffic.Routing, []string)

CompositeRoutingV1AndV2 The routing rules of the V1 version and the rules of the V2 version

func ConvertRoutingV1ToExtendV2 added in v1.17.2

func ConvertRoutingV1ToExtendV2(svcName, svcNamespace string,
	rule *RoutingConfig) ([]*ExtendRouterConfig, []*ExtendRouterConfig, error)

ConvertRoutingV1ToExtendV2 The routing rules of the V1 version are converted to V2 version for storage TODO Reduce duplicate code logic

func ConvertToErrCode added in v1.18.0

func ConvertToErrCode(err error) apimodel.Code

func ExportToMap added in v1.18.0

func ExportToMap(exportTo []*wrappers.StringValue) map[string]struct{}

func FromTagMap added in v1.17.3

func FromTagMap(kvs map[string]string) []*config_manage.ConfigFileTag

FromTagJson 从 Tags Json 字符串里反序列化出 Tags

func GetGrayConfigRealseKey added in v1.18.0

func GetGrayConfigRealseKey(release *SimpleConfigFileRelease) string

GetGrayConfigRealseKey 获取灰度资源key

func Int2bool

func Int2bool(entry int) bool

Int2bool 整数转换为bool值

func MarshalModCmd added in v1.17.3

func MarshalModCmd(modID uint32, cmdID uint32) string

MarshalModCmd mod cmd转为sid

func MarshalSid added in v1.17.3

func MarshalSid(sid *Sid) string

MarshalSid Sid结构体,序列化转为sid字符串

func ParseRouteRuleAnyToMessage added in v1.14.0

func ParseRouteRuleAnyToMessage(policy apitraffic.RoutingPolicy, anyMessage *anypb.Any) (proto.Message, error)

ParseRouteRuleAnyToMessage convert the any routing proto to message object

func RoutingArguments2Labels added in v1.17.2

func RoutingArguments2Labels(args []*apitraffic.SourceMatch) map[string]*apimodel.MatchString

RoutingArguments2Labels Adapt the parameter list to the old label model

func RoutingConfigV1ToAPI added in v1.17.2

func RoutingConfigV1ToAPI(req *RoutingConfig, service string, namespace string) (*apitraffic.Routing, error)

RoutingConfigV1ToAPI Convert the internal data structure to API parameter to pass out

func RoutingLabels2Arguments added in v1.17.2

func RoutingLabels2Arguments(labels map[string]*apimodel.MatchString) []*apitraffic.SourceMatch

RoutingLabels2Arguments Adapting the old label model into a list of parameters

func StatusBoolToInt

func StatusBoolToInt(value bool) int

StatusBoolToInt 状态bool转int

func Store2ClientStat

func Store2ClientStat(clientStatStore *ClientStatStore) *apiservice.StatInfo

func ToConfigFileAPI added in v1.17.3

func ToConfigFileAPI(file *ConfigFile) *config_manage.ConfigFile

func ToConfigFileTemplateAPI added in v1.17.3

func ToConfigFileTemplateAPI(template *ConfigFileTemplate) *config_manage.ConfigFileTemplate

func ToConfigGroupAPI added in v1.17.3

func ToConfigGroupAPI(group *ConfigFileGroup) *config_manage.ConfigFileGroup

func ToConfiogFileReleaseApi added in v1.17.3

func ToConfiogFileReleaseApi(release *ConfigFileRelease) *config_manage.ConfigFileRelease

ToConfiogFileReleaseApi

func ToReleaseHistoryAPI added in v1.17.3

func ToReleaseHistoryAPI(releaseHistory *ConfigFileReleaseHistory) *config_manage.ConfigFileReleaseHistory

func ToTagMap added in v1.17.3

func ToTagMap(tags []*config_manage.ConfigFileTag) map[string]string

func WithAccessResources

func WithAccessResources(accessResources map[apisecurity.ResourceType][]ResourceEntry) acquireContextOption

WithAccessResources 设置本次访问的资源

@param accessResources
@return acquireContextOption

func WithAttachment

func WithAttachment(attachment map[string]interface{}) acquireContextOption

WithAttachment 设置本次请求的额外携带信息

@param attachment
@return acquireContextOption

func WithFromClient

func WithFromClient() acquireContextOption

WithFromClient 设置本次请求来自客户端

func WithFromConsole

func WithFromConsole() acquireContextOption

WithFromConsole 设置本次请求来自控制台

func WithMethod

func WithMethod(method string) acquireContextOption

WithMethod 本次操作函数名称

func WithModule

func WithModule(module BzModule) acquireContextOption

WithModule 设置本次请求的模块

@param module
@return acquireContextOption

func WithOperation

func WithOperation(operation ResourceOperation) acquireContextOption

WithOperation 设置本次的操作类型

@param operation
@return acquireContextOption

func WithRequestContext

func WithRequestContext(ctx context.Context) acquireContextOption

WithRequestContext 设置请求上下文

@param ctx
@return acquireContextOption

Types

type AcquireContext

type AcquireContext struct {
	// contains filtered or unexported fields
}

AcquireContext 每次鉴权请求上下文信息

func NewAcquireContext

func NewAcquireContext(options ...acquireContextOption) *AcquireContext

NewAcquireContext 创建一个请求响应

@param options
@return *AcquireContext

func (*AcquireContext) GetAccessResources

func (authCtx *AcquireContext) GetAccessResources() map[apisecurity.ResourceType][]ResourceEntry

GetAccessResources 获取本次请求的资源

@receiver authCtx
@return map

func (*AcquireContext) GetAttachment

func (authCtx *AcquireContext) GetAttachment(key string) (interface{}, bool)

GetAttachment 按照 key 获取某一个附件信息

func (*AcquireContext) GetAttachments

func (authCtx *AcquireContext) GetAttachments() map[string]interface{}

GetAttachments 获取本次请求的额外携带信息

func (*AcquireContext) GetMethod

func (authCtx *AcquireContext) GetMethod() string

GetMethod 获取本次请求涉及的操作函数

func (*AcquireContext) GetModule

func (authCtx *AcquireContext) GetModule() BzModule

GetModule 获取请求的模块

@receiver authCtx
@return BzModule

func (*AcquireContext) GetOperation

func (authCtx *AcquireContext) GetOperation() ResourceOperation

GetOperation 获取本次操作的类型

@receiver authCtx
@return ResourceOperation

func (*AcquireContext) GetRequestContext

func (authCtx *AcquireContext) GetRequestContext() context.Context

GetRequestContext 获取 context.Context

@receiver authCtx
@return context.Context

func (*AcquireContext) IsAccessResourceEmpty

func (authCtx *AcquireContext) IsAccessResourceEmpty() bool

IsAccessResourceEmpty 判断当前待访问的资源,是否为空

func (*AcquireContext) IsFromClient

func (authCtx *AcquireContext) IsFromClient() bool

IsFromClient 本次请求是否来自客户端

func (*AcquireContext) IsFromConsole

func (authCtx *AcquireContext) IsFromConsole() bool

IsFromConsole 本次请求是否来自OpenAPI

func (*AcquireContext) SetAccessResources

func (authCtx *AcquireContext) SetAccessResources(accessRes map[apisecurity.ResourceType][]ResourceEntry)

SetAccessResources 设置本次请求的资源

@receiver authCtx
@param accessRes

func (*AcquireContext) SetAttachment

func (authCtx *AcquireContext) SetAttachment(key string, val interface{})

SetAttachment 设置附件

func (*AcquireContext) SetFromClient added in v1.17.3

func (authCtx *AcquireContext) SetFromClient()

SetFromClient 本次请求来自客户端

func (*AcquireContext) SetFromConsole added in v1.17.3

func (authCtx *AcquireContext) SetFromConsole()

SetFromConsole 本次请求来自OpenAPI

func (*AcquireContext) SetRequestContext

func (authCtx *AcquireContext) SetRequestContext(requestContext context.Context)

SetRequestContext 重新设置 context.Context

@receiver authCtx
@param requestContext

type BzModule

type BzModule int16

BzModule 模块标识

const (
	// UnknowModule 未知模块
	UnknowModule BzModule = iota
	// CoreModule 核心模块
	CoreModule
	// DiscoverModule 服务模块
	DiscoverModule
	// ConfigModule 配置模块
	ConfigModule
	// AuthModule 鉴权模块
	AuthModule
	// MaintainModule 运维操作模块
	MaintainModule
	// BootstrapModule 初始化模块
	BootstrapModule
)

type Callee

type Callee struct {
	ModID    uint32
	CmdID    uint32
	SetID    string
	IP       uint32
	Port     uint32
	Weight   uint32
	Location *Location
}

Callee 被调信息,对应t_server+t_ip_config

type CircuitBreaker

type CircuitBreaker struct {
	ID         string
	Version    string
	Name       string
	Namespace  string
	Business   string
	Department string
	Comment    string
	Inbounds   string
	Outbounds  string
	Token      string
	Owner      string
	Revision   string
	Valid      bool
	CreateTime time.Time
	ModifyTime time.Time
}

CircuitBreaker 熔断规则

type CircuitBreakerDetail

type CircuitBreakerDetail struct {
	Total               uint32
	CircuitBreakerInfos []*CircuitBreakerInfo
}

CircuitBreakerDetail 返回给控制台的熔断规则及服务数据

type CircuitBreakerInfo

type CircuitBreakerInfo struct {
	CircuitBreaker *CircuitBreaker
	Services       []*Service
}

CircuitBreakerInfo 熔断规则及绑定服务

type CircuitBreakerRelation

type CircuitBreakerRelation struct {
	ServiceID   string
	RuleID      string
	RuleVersion string
	Valid       bool
	CreateTime  time.Time
	ModifyTime  time.Time
}

CircuitBreakerRelation 熔断规则绑定关系

type CircuitBreakerRule added in v1.14.0

type CircuitBreakerRule struct {
	Proto        *apifault.CircuitBreakerRule
	ID           string
	Name         string
	Namespace    string
	Description  string
	Level        int
	SrcService   string
	SrcNamespace string
	DstService   string
	DstNamespace string
	DstMethod    string
	Rule         string
	Revision     string
	Enable       bool
	Valid        bool
	CreateTime   time.Time
	ModifyTime   time.Time
	EnableTime   time.Time
}

CircuitBreakerRule 熔断规则

func (*CircuitBreakerRule) IsServiceChange added in v1.17.3

func (c *CircuitBreakerRule) IsServiceChange(other *CircuitBreakerRule) bool

type Cl5ServerCluster added in v1.17.3

type Cl5ServerCluster struct{}

Cl5ServerCluster cl5集群的ctx的key

type Cl5ServerProtocol added in v1.17.3

type Cl5ServerProtocol struct{}

Cl5ServerProtocol cl5.server的协议ctx

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 客户端上报信息表

func NewClient

func NewClient(req *apiservice.Client) *Client

func Store2Client

func Store2Client(is *ClientStore) *Client

Store2Instance store的数据转换为组合了api的数据结构

func (*Client) ModifyTime

func (c *Client) ModifyTime() time.Time

func (*Client) Proto

func (c *Client) Proto() *apiservice.Client

func (*Client) SetValid

func (c *Client) SetValid(v bool)

func (*Client) Valid

func (c *Client) Valid() bool

type ClientEvent added in v1.18.0

type ClientEvent struct {
	EType InstanceEventType
	Id    string
}

type ClientStatStore

type ClientStatStore struct {
	Target   string
	Port     uint32
	Protocol string
	Path     string
}

type ClientStore

type ClientStore struct {
	ID         string
	Host       string
	Type       string
	Version    string
	Region     string
	Zone       string
	Campus     string
	Stat       ClientStatStore
	Flag       int
	CreateTime int64
	ModifyTime int64
}

ClientStore 对应store层(database)的对象

type ConfigFile

type ConfigFile struct {
	Id        uint64
	Name      string
	Namespace string
	Group     string
	// OriginContent 最原始的配置文件内容数据
	OriginContent string
	Content       string
	Comment       string
	Format        string
	Flag          int
	Valid         bool
	Metadata      map[string]string
	Encrypt       bool
	EncryptAlgo   string
	Status        string
	CreateBy      string
	ModifyBy      string
	ReleaseBy     string
	CreateTime    time.Time
	ModifyTime    time.Time
	ReleaseTime   time.Time
}

ConfigFile 配置文件数据持久化对象

func ToConfigFileStore added in v1.17.3

func ToConfigFileStore(file *config_manage.ConfigFile) *ConfigFile

func (*ConfigFile) GetEncryptAlgo added in v1.17.3

func (s *ConfigFile) GetEncryptAlgo() string

func (*ConfigFile) GetEncryptDataKey added in v1.17.3

func (s *ConfigFile) GetEncryptDataKey() string

func (*ConfigFile) IsEncrypted added in v1.17.3

func (s *ConfigFile) IsEncrypted() bool

func (*ConfigFile) Key added in v1.17.3

func (s *ConfigFile) Key() *ConfigFileKey

func (*ConfigFile) KeyString added in v1.17.3

func (s *ConfigFile) KeyString() string

type ConfigFileGroup

type ConfigFileGroup struct {
	Id         uint64
	Name       string
	Namespace  string
	Comment    string
	Owner      string
	Business   string
	Department string
	Metadata   map[string]string
	CreateTime time.Time
	ModifyTime time.Time
	CreateBy   string
	ModifyBy   string
	Valid      bool
	Revision   string
}

ConfigFileGroup 配置文件组数据持久化对象

func ToConfigGroupStore added in v1.17.3

func ToConfigGroupStore(group *config_manage.ConfigFileGroup) *ConfigFileGroup

type ConfigFileKey added in v1.17.3

type ConfigFileKey struct {
	Name      string
	Namespace string
	Group     string
}

func (ConfigFileKey) String added in v1.18.0

func (c ConfigFileKey) String() string

type ConfigFileRelease

type ConfigFileRelease struct {
	*SimpleConfigFileRelease
	Content string
}

ConfigFileRelease 配置文件发布数据持久化对象

func NewConfigFileRelease added in v1.17.3

func NewConfigFileRelease() *ConfigFileRelease

func ToConfigFileReleaseStore added in v1.17.3

func ToConfigFileReleaseStore(release *config_manage.ConfigFileRelease) *ConfigFileRelease

ToConfigFileReleaseStore

type ConfigFileReleaseHistory

type ConfigFileReleaseHistory struct {
	Id                 uint64
	Name               string
	Namespace          string
	Group              string
	FileName           string
	Format             string
	Metadata           map[string]string
	Content            string
	Comment            string
	Version            uint64
	Md5                string
	Type               string
	Status             string
	CreateTime         time.Time
	CreateBy           string
	ModifyTime         time.Time
	ModifyBy           string
	Valid              bool
	Reason             string
	ReleaseDescription string
}

ConfigFileReleaseHistory 配置文件发布历史记录数据持久化对象

func (ConfigFileReleaseHistory) GetEncryptAlgo added in v1.17.3

func (s ConfigFileReleaseHistory) GetEncryptAlgo() string

func (ConfigFileReleaseHistory) GetEncryptDataKey added in v1.17.3

func (s ConfigFileReleaseHistory) GetEncryptDataKey() string

func (ConfigFileReleaseHistory) IsEncrypted added in v1.17.3

func (s ConfigFileReleaseHistory) IsEncrypted() bool

type ConfigFileReleaseKey added in v1.17.3

type ConfigFileReleaseKey struct {
	Id          uint64
	Name        string
	Namespace   string
	Group       string
	FileName    string
	ReleaseType ReleaseType
}

func (ConfigFileReleaseKey) ActiveKey added in v1.17.3

func (c ConfigFileReleaseKey) ActiveKey() string

func (ConfigFileReleaseKey) FileKey added in v1.18.0

func (c ConfigFileReleaseKey) FileKey() string

func (*ConfigFileReleaseKey) OwnerKey added in v1.17.3

func (c *ConfigFileReleaseKey) OwnerKey() string

func (ConfigFileReleaseKey) ReleaseKey added in v1.17.3

func (c ConfigFileReleaseKey) ReleaseKey() string

func (ConfigFileReleaseKey) ToFileKey added in v1.17.3

func (c ConfigFileReleaseKey) ToFileKey() *ConfigFileKey

type ConfigFileTag

type ConfigFileTag struct {
	Id         uint64
	Key        string
	Value      string
	Namespace  string
	Group      string
	FileName   string
	CreateTime time.Time
	CreateBy   string
	ModifyTime time.Time
	ModifyBy   string
	Valid      bool
}

ConfigFileTag 配置文件标签数据持久化对象

type ConfigFileTemplate

type ConfigFileTemplate struct {
	Id         uint64
	Name       string
	Content    string
	Comment    string
	Format     string
	CreateTime time.Time
	CreateBy   string
	ModifyTime time.Time
	ModifyBy   string
}

ConfigFileTemplate config file template data object

func ToConfigFileTemplateStore added in v1.17.3

func ToConfigFileTemplateStore(template *config_manage.ConfigFileTemplate) *ConfigFileTemplate

type ContextKeyAutoCreateNamespace added in v1.18.0

type ContextKeyAutoCreateNamespace struct{}

ContextKeyAutoCreateNamespace .

type ContextKeyAutoCreateService added in v1.18.0

type ContextKeyAutoCreateService struct{}

ContextKeyAutoCreateService .

type DebugHandler added in v1.18.0

type DebugHandler struct {
	Desc    string
	Path    string
	Handler http.HandlerFunc
}

type DebugHandlerGroup added in v1.18.0

type DebugHandlerGroup struct {
	Name     string
	Handlers []DebugHandler
}

type EnhancedService

type EnhancedService struct {
	*Service
	TotalInstanceCount   uint32
	HealthyInstanceCount uint32
}

EnhancedService 服务增强数据

type EnrichServiceContract added in v1.18.0

type EnrichServiceContract struct {
	*ServiceContract

	// 接口描述信息
	Interfaces       []*InterfaceDescriptor
	ClientInterfaces map[string]*InterfaceDescriptor
	ManualInterfaces map[string]*InterfaceDescriptor
	// contains filtered or unexported fields
}

func (*EnrichServiceContract) Format added in v1.18.0

func (e *EnrichServiceContract) Format()

func (*EnrichServiceContract) ToSpec added in v1.18.0

type ExpandInstanceStore

type ExpandInstanceStore struct {
	ServiceName       string
	Namespace         string
	ServiceToken      string
	ServicePlatformID string
	ServiceInstance   *InstanceStore
}

ExpandInstanceStore 包含服务名的store信息

type ExtendRateLimit

type ExtendRateLimit struct {
	ServiceName   string
	NamespaceName string
	RateLimit     *RateLimit
}

ExtendRateLimit 包含服务信息的限流规则

type ExtendRouterConfig added in v1.14.0

type ExtendRouterConfig struct {
	*RouterConfig
	// MetadataRouting 元数据路由配置
	MetadataRouting *apitraffic.MetadataRoutingConfig
	// RuleRouting 规则路由配置
	RuleRouting *apitraffic.RuleRoutingConfig
	// ExtendInfo 额外信息数据
	ExtendInfo map[string]string
}

ExtendRouterConfig 路由信息的扩展

func BuildV2ExtendRouting added in v1.17.2

func BuildV2ExtendRouting(req *apitraffic.Routing, route *apitraffic.Route) (*ExtendRouterConfig, error)

BuildV2ExtendRouting Build the internal data object routing rules of V2 version

func (*ExtendRouterConfig) ToApi added in v1.14.0

ToApi Turn to API object

type ExtendRoutingConfig

type ExtendRoutingConfig struct {
	ServiceName   string
	NamespaceName string
	Config        *RoutingConfig
}

ExtendRoutingConfig 路由配置的扩展结构体

type FaultDetectRule added in v1.14.0

type FaultDetectRule struct {
	Proto        *apifault.FaultDetectRule
	ID           string
	Name         string
	Namespace    string
	Description  string
	DstService   string
	DstNamespace string
	DstMethod    string
	Rule         string
	Revision     string
	Valid        bool
	CreateTime   time.Time
	ModifyTime   time.Time
}

FaultDetectRule 故障探测规则

func (*FaultDetectRule) IsServiceChange added in v1.17.3

func (c *FaultDetectRule) IsServiceChange(other *FaultDetectRule) bool

type GrayModule added in v1.18.0

type GrayModule string
const (
	GrayModuleConfig         GrayModule = "config"
	GrayModuleRatelimit      GrayModule = "ratelimit"
	GrayModuleCircuitbreaker GrayModule = "circuitbreaker"
	GrayModuleRoute          GrayModule = "route"
)

type GrayResource added in v1.18.0

type GrayResource struct {
	Name       string
	MatchRule  string
	CreateTime time.Time
	ModifyTime time.Time
	CreateBy   string
	ModifyBy   string
	Valid      bool
}

GrayRule 灰度资源

type IPConfig

type IPConfig struct {
	IP     uint32
	AreaID uint32
	CityID uint32
	IdcID  uint32
	Valid  bool
	Flow   uint32
}

IPConfig IP的区域信息

type Instance

type Instance struct {
	Proto             *apiservice.Instance
	ServiceID         string
	ServicePlatformID string
	// Valid Whether it is deleted by logic
	Valid bool
	// ModifyTime Update time of instance
	ModifyTime time.Time
}

Instance 组合了api的Instance对象

func CreateInstanceModel added in v1.17.0

func CreateInstanceModel(serviceID string, req *apiservice.Instance) *Instance

CreateInstanceModel 创建存储层服务实例模型

func ExpandStore2Instance

func ExpandStore2Instance(es *ExpandInstanceStore) *Instance

ExpandStore2Instance 扩展store转换

func Store2Instance

func Store2Instance(is *InstanceStore) *Instance

Store2Instance store的数据转换为组合了api的数据结构

func (*Instance) Ctime

func (i *Instance) Ctime() string

Ctime get ctime

func (*Instance) EnableHealthCheck

func (i *Instance) EnableHealthCheck() bool

EnableHealthCheck get enables health check

func (*Instance) HealthCheck

func (i *Instance) HealthCheck() *apiservice.HealthCheck

HealthCheck get health check

func (*Instance) Healthy

func (i *Instance) Healthy() bool

Healthy get healthy

func (*Instance) Host

func (i *Instance) Host() string

Host get host

func (*Instance) ID

func (i *Instance) ID() string

ID get id

func (*Instance) Isolate

func (i *Instance) Isolate() bool

Isolate get isolate

func (*Instance) Location

func (i *Instance) Location() *apimodel.Location

Location gets location

func (*Instance) LogicSet

func (i *Instance) LogicSet() string

LogicSet get logic set

func (*Instance) MallocProto

func (i *Instance) MallocProto()

MallocProto malloc proto if proto is null

func (*Instance) Metadata

func (i *Instance) Metadata() map[string]string

Metadata get metadata

func (*Instance) Mtime

func (i *Instance) Mtime() string

Mtime get mtime

func (*Instance) Namespace

func (i *Instance) Namespace() string

Namespace get namespace

func (*Instance) Port

func (i *Instance) Port() uint32

Port get port

func (*Instance) Priority

func (i *Instance) Priority() uint32

Priority gets priority

func (*Instance) Protocol

func (i *Instance) Protocol() string

Protocol get protocol

func (*Instance) Revision

func (i *Instance) Revision() string

Revision get revision

func (*Instance) Service

func (i *Instance) Service() string

Service get service

func (*Instance) ServiceToken

func (i *Instance) ServiceToken() string

ServiceToken get service token

func (*Instance) Version

func (i *Instance) Version() string

Version get version

func (*Instance) VpcID

func (i *Instance) VpcID() string

VpcID get vpcid

func (*Instance) Weight

func (i *Instance) Weight() uint32

Weight get weight

type InstanceCount

type InstanceCount struct {
	// IsolateInstanceCount 隔离状态的实例
	IsolateInstanceCount uint32
	// HealthyInstanceCount 健康实例数
	HealthyInstanceCount uint32
	// TotalInstanceCount 总实例数
	TotalInstanceCount uint32
	// VersionCounts 按照实例的版本进行统计计算
	VersionCounts map[string]*InstanceVersionCount
}

InstanceCount Service instance statistics

type InstanceEvent

type InstanceEvent struct {
	Id         string
	SvcId      string
	Namespace  string
	Service    string
	Instance   *apiservice.Instance
	EType      InstanceEventType
	CreateTime time.Time
	MetaData   map[string]string
}

InstanceEvent 服务实例事件

func (*InstanceEvent) InjectMetadata added in v1.13.3

func (i *InstanceEvent) InjectMetadata(ctx context.Context)

InjectMetadata 从context中获取metadata并注入到事件对象

func (*InstanceEvent) String added in v1.13.8

func (i *InstanceEvent) String() string

type InstanceEventType

type InstanceEventType string

InstanceEventType 探测事件类型

const (
	// EventDiscoverNone empty discover event
	EventDiscoverNone InstanceEventType = "EventDiscoverNone"
	// EventInstanceOnline instance becoming online
	EventInstanceOnline InstanceEventType = "InstanceOnline"
	// EventInstanceTurnUnHealth Instance becomes unhealthy
	EventInstanceTurnUnHealth InstanceEventType = "InstanceTurnUnHealth"
	// EventInstanceTurnHealth Instance becomes healthy
	EventInstanceTurnHealth InstanceEventType = "InstanceTurnHealth"
	// EventInstanceOpenIsolate Instance is in isolation
	EventInstanceOpenIsolate InstanceEventType = "InstanceOpenIsolate"
	// EventInstanceCloseIsolate Instance shutdown isolation state
	EventInstanceCloseIsolate InstanceEventType = "InstanceCloseIsolate"
	// EventInstanceOffline Instance offline
	EventInstanceOffline InstanceEventType = "InstanceOffline"
	// EventInstanceSendHeartbeat Instance send heartbeat package to server
	EventInstanceSendHeartbeat InstanceEventType = "InstanceSendHeartbeat"
	// EventInstanceUpdate Instance metadata and info update event
	EventInstanceUpdate InstanceEventType = "InstanceUpdate"
	// EventClientOffline .
	EventClientOffline InstanceEventType = "ClientOffline"
)

type InstanceStore

type InstanceStore struct {
	ID                string
	ServiceID         string
	Host              string
	VpcID             string
	Port              uint32
	Protocol          string
	Version           string
	HealthStatus      int
	Isolate           int
	Weight            uint32
	EnableHealthCheck int
	CheckType         int32
	TTL               uint32
	Priority          uint32
	Revision          string
	LogicSet          string
	Region            string
	Zone              string
	Campus            string
	Meta              map[string]string
	Flag              int
	CreateTime        int64
	ModifyTime        int64
}

InstanceStore 对应store层(database)的对象

type InstanceVersionCount added in v1.18.0

type InstanceVersionCount struct {
	// IsolateInstanceCount 隔离状态的实例
	IsolateInstanceCount uint32
	// HealthyInstanceCount 健康实例数
	HealthyInstanceCount uint32
	// TotalInstanceCount 总实例数
	TotalInstanceCount uint32
}

InstanceVersionCount instance version metrics count

type InterfaceDescriptor added in v1.18.0

type InterfaceDescriptor struct {
	// ID
	ID string
	// Name 接口名称
	Name string
	// ContractID
	ContractID string
	// 方法名称,对应 http method/ dubbo interface func/grpc service func
	Method string
	// 接口名称,http path/dubbo interface/grpc service
	Path string
	// 接口描述信息
	Content string
	// 接口信息摘要
	Revision string
	// 创建来源
	Source apiservice.InterfaceDescriptor_Source
	// 创建时间
	CreateTime time.Time
	// 更新时间
	ModifyTime time.Time
	// Valid
	Valid bool
}

type LeaderElection added in v1.14.0

type LeaderElection struct {
	ElectKey   string
	Host       string
	Ctime      int64
	CreateTime time.Time
	Mtime      int64
	ModifyTime time.Time
	Valid      bool
}

LeaderElection leader election info

type Location

type Location struct {
	Proto    *apimodel.Location
	RegionID uint32
	ZoneID   uint32
	CampusID uint32
	Valid    bool
}

Location cmdb信息,对应内存结构体

func Store2Location

func Store2Location(s *LocationStore) *Location

Store2Location 转成内存数据结构

type LocationStore

type LocationStore struct {
	IP         string
	Region     string
	Zone       string
	Campus     string
	RegionID   uint32
	ZoneID     uint32
	CampusID   uint32
	Flag       int
	ModifyTime int64
}

LocationStore 地域信息,对应数据库字段

type LocationView added in v1.14.0

type LocationView struct {
	IP       string
	Region   string
	Zone     string
	Campus   string
	RegionID uint32
	ZoneID   uint32
	CampusID uint32
}

LocationView cmdb信息,对应内存结构体

type ModifyStrategyDetail

type ModifyStrategyDetail struct {
	ID               string
	Name             string
	Action           string
	Comment          string
	AddPrincipals    []Principal
	RemovePrincipals []Principal
	AddResources     []StrategyResource
	RemoveResources  []StrategyResource
	ModifyTime       time.Time
}

ModifyStrategyDetail 修改鉴权策略详细

type ModifyUserGroup

type ModifyUserGroup struct {
	ID            string
	Owner         string
	Token         string
	TokenEnable   bool
	Comment       string
	AddUserIds    []string
	RemoveUserIds []string
}

ModifyUserGroup 用户组修改

type Namespace

type Namespace struct {
	Name       string
	Comment    string
	Token      string
	Owner      string
	Valid      bool
	CreateTime time.Time
	ModifyTime time.Time
	// ServiceExportTo 服务可见性设置
	ServiceExportTo map[string]struct{}
}

Namespace 命名空间结构体

func (*Namespace) ListServiceExportTo added in v1.18.0

func (n *Namespace) ListServiceExportTo() []*wrappers.StringValue

type NamespaceServiceCount

type NamespaceServiceCount struct {
	// ServiceCount 服务数量
	ServiceCount uint32
	// InstanceCnt 实例健康数/实例总数
	InstanceCnt *InstanceCount
}

NamespaceServiceCount Namespace service data

type OperationType

type OperationType string

OperationType Operating type

const (
	// OCreate create
	OCreate OperationType = "Create"
	// ODelete delete
	ODelete OperationType = "Delete"
	// OUpdate update
	OUpdate OperationType = "Update"
	// OUpdateIsolate Update isolation state
	OUpdateIsolate OperationType = "UpdateIsolate"
	// OUpdateToken Update token
	OUpdateToken OperationType = "UpdateToken"
	// OUpdateGroup Update user-user group association relationship
	OUpdateGroup OperationType = "UpdateGroup"
	// OEnableRateLimit Update enable state
	OUpdateEnable OperationType = "UpdateEnable"
	// ORollback Rollback resource
	ORollback OperationType = "Rollback"
)

Define the type of operation containing

type Policy

type Policy struct {
	ModID uint32
	Div   uint32
	Mod   uint32
	Valid bool
	Flow  uint32
}

Policy 有状态规则路由策略信息

type Principal

type Principal struct {
	StrategyID    string
	PrincipalID   string
	PrincipalRole PrincipalType
}

Principal 策略相关人

type PrincipalType

type PrincipalType int
const (
	PrincipalUser  PrincipalType = 1
	PrincipalGroup PrincipalType = 2
)

func (PrincipalType) String

func (i PrincipalType) String() string

type PrometheusDiscoveryResponse

type PrometheusDiscoveryResponse struct {
	Code     uint32
	Response []PrometheusTarget
}

type PrometheusTarget

type PrometheusTarget struct {
	Targets []string          `json:"targets"`
	Labels  map[string]string `json:"labels"`
}

PrometheusTarget 用于对接 prometheus service discovery 的数据结构

type RateLimit

type RateLimit struct {
	Proto     *apitraffic.Rule
	ID        string
	ServiceID string
	Name      string
	Method    string
	// Labels for old compatible, will be removed later
	Labels     string
	Priority   uint32
	Rule       string
	Revision   string
	Disable    bool
	Valid      bool
	CreateTime time.Time
	ModifyTime time.Time
	EnableTime time.Time
}

RateLimit 限流规则

func (*RateLimit) AdaptArgumentsAndLabels

func (r *RateLimit) AdaptArgumentsAndLabels() error

AdaptArgumentsAndLabels 对存量标签进行兼容,同时将argument适配成标签

func (*RateLimit) AdaptLabels

func (r *RateLimit) AdaptLabels() error

AdaptLabels 对存量标签进行兼容,对存量labels进行清空

func (*RateLimit) Labels2Arguments

func (r *RateLimit) Labels2Arguments() (map[string]*apimodel.MatchString, error)

Labels2Arguments 适配老的标签到新的参数列表

type RateLimitRevision

type RateLimitRevision struct {
	ServiceID    string
	LastRevision string
	ModifyTime   time.Time
}

RateLimitRevision 包含最新版本号的限流规则

type RecordEntry

type RecordEntry struct {
	ResourceType  Resource
	ResourceName  string
	Namespace     string
	Operator      string
	OperationType OperationType
	Detail        string
	Server        string
	HappenTime    time.Time
}

RecordEntry Operation records

func (*RecordEntry) String

func (r *RecordEntry) String() string

type ReleaseType added in v1.18.0

type ReleaseType string

type Resource

type Resource string

Resource Operating resources

const (
	RNamespace          Resource = "Namespace"
	RService            Resource = "Service"
	RRouting            Resource = "Routing"
	RCircuitBreaker     Resource = "CircuitBreaker"
	RInstance           Resource = "Instance"
	RRateLimit          Resource = "RateLimit"
	RUser               Resource = "User"
	RUserGroup          Resource = "UserGroup"
	RUserGroupRelation  Resource = "UserGroupRelation"
	RAuthStrategy       Resource = "AuthStrategy"
	RConfigGroup        Resource = "ConfigGroup"
	RConfigFile         Resource = "ConfigFile"
	RConfigFileRelease  Resource = "ConfigFileRelease"
	RCircuitBreakerRule Resource = "CircuitBreakerRule"
	RFaultDetectRule    Resource = "FaultDetectRule"
	RServiceContract    Resource = "ServiceContract"
)

Define the type of resource type

type ResourceEntry

type ResourceEntry struct {
	ID    string
	Owner string
}

ResourceEntry 资源最简单信息

type ResourceOperation

type ResourceOperation int16

ResourceOperation 资源操作

const (
	// Read 只读动作
	Read ResourceOperation = 10
	// Create 创建动作
	Create ResourceOperation = 20
	// Modify 修改动作
	Modify ResourceOperation = 30
	// Delete 删除动作
	Delete ResourceOperation = 40
)

type Route

type Route struct {
	IP    uint32
	ModID uint32
	CmdID uint32
	SetID string
	Valid bool
	Flow  uint32
}

Route 访问关系

type RouterConfig added in v1.14.0

type RouterConfig struct {
	// ID The unique id of the rules
	ID string `json:"id"`
	// namespace router config owner namespace
	Namespace string `json:"namespace"`
	// name router config name
	Name string `json:"name"`
	// policy Rules
	Policy string `json:"policy"`
	// config Specific routing rules content
	Config string `json:"config"`
	// enable Whether the routing rules are enabled
	Enable bool `json:"enable"`
	// priority Rules priority
	Priority uint32 `json:"priority"`
	// revision Edition information of routing rules
	Revision string `json:"revision"`
	// Description Simple description of rules
	Description string `json:"description"`
	// valid Whether the routing rules are valid and have not been deleted by logic
	Valid bool `json:"flag"`
	// createtime Rules creation time
	CreateTime time.Time `json:"ctime"`
	// modifytime Rules modify time
	ModifyTime time.Time `json:"mtime"`
	// enabletime The last time the rules enabled
	EnableTime time.Time `json:"etime"`
}

RouterConfig Routing rules

func (*RouterConfig) GetRoutingPolicy added in v1.14.0

func (r *RouterConfig) GetRoutingPolicy() apitraffic.RoutingPolicy

GetRoutingPolicy Query routing rules type

func (*RouterConfig) ParseRouteRuleFromAPI added in v1.14.0

func (r *RouterConfig) ParseRouteRuleFromAPI(routing *apitraffic.RouteRule) error

ParseRouteRuleFromAPI Convert an internal object from the API object

func (*RouterConfig) ToExpendRoutingConfig added in v1.14.0

func (r *RouterConfig) ToExpendRoutingConfig() (*ExtendRouterConfig, error)

ToExpendRoutingConfig Converted to an expansion object, serialize the corresponding PB Struct in advance

type RoutingConfig

type RoutingConfig struct {
	ID         string
	InBounds   string
	OutBounds  string
	Revision   string
	Valid      bool
	CreateTime time.Time
	ModifyTime time.Time
}

* RoutingConfig 路由配置

type Section

type Section struct {
	ModID uint32
	From  uint32
	To    uint32
	Xid   uint32
	Valid bool
	Flow  uint32
}

Section 有状态规则路由分段信息

type Service

type Service struct {
	ID           string
	Name         string
	Namespace    string
	Business     string
	Ports        string
	Meta         map[string]string
	Comment      string
	Department   string
	CmdbMod1     string
	CmdbMod2     string
	CmdbMod3     string
	Token        string
	Owner        string
	Revision     string
	Reference    string
	ReferFilter  string
	PlatformID   string
	Valid        bool
	CreateTime   time.Time
	ModifyTime   time.Time
	Mtime        int64
	Ctime        int64
	ServicePorts []*ServicePort
	// ExportTo 服务可见性暴露设置
	ExportTo    map[string]struct{}
	OldExportTo map[string]struct{}
}

Service 服务数据

func (*Service) IsAlias

func (s *Service) IsAlias() bool

IsAlias 便捷函数封装

func (*Service) ListExportTo added in v1.18.0

func (s *Service) ListExportTo() []*wrappers.StringValue

func (*Service) ProtectThreshold added in v1.18.0

func (s *Service) ProtectThreshold() float32

type ServiceAlias

type ServiceAlias struct {
	ID             string
	Alias          string
	AliasNamespace string
	ServiceID      string
	Service        string
	Namespace      string
	Owner          string
	Comment        string
	CreateTime     time.Time
	ModifyTime     time.Time
	ExportTo       map[string]struct{}
}

ServiceAlias 服务别名结构体

type ServiceContract added in v1.18.0

type ServiceContract struct {
	ID string
	// 所属命名空间
	Namespace string
	// 所属服务名称
	Service string
	// 契约名称
	Name string
	// 协议,http/grpc/dubbo/thrift
	Protocol string
	// 契约版本
	Version string
	// 信息摘要
	Revision string
	// 额外描述
	Content string
	// 创建时间
	CreateTime time.Time
	// 更新时间
	ModifyTime time.Time
	// 是否有效
	Valid bool
}

func (*ServiceContract) GetCacheKey added in v1.18.0

func (s *ServiceContract) GetCacheKey() string

func (*ServiceContract) GetResourceName added in v1.18.0

func (s *ServiceContract) GetResourceName() string

type ServiceInstances added in v1.18.0

type ServiceInstances struct {
	// contains filtered or unexported fields
}

func NewServiceInstances added in v1.18.0

func NewServiceInstances(protectThreshold float32) *ServiceInstances

func (*ServiceInstances) GetInstances added in v1.18.0

func (si *ServiceInstances) GetInstances(onlyHealthy bool) []*Instance

func (*ServiceInstances) Range added in v1.18.0

func (si *ServiceInstances) Range(iterator func(id string, ins *Instance))

func (*ServiceInstances) ReachHealthyProtect added in v1.18.0

func (si *ServiceInstances) ReachHealthyProtect() bool

func (*ServiceInstances) RemoveInstance added in v1.18.0

func (si *ServiceInstances) RemoveInstance(ins *Instance)

func (*ServiceInstances) RunHealthyProtect added in v1.18.0

func (si *ServiceInstances) RunHealthyProtect()

func (*ServiceInstances) TotalCount added in v1.18.0

func (si *ServiceInstances) TotalCount() int

func (*ServiceInstances) UpdateProtectThreshold added in v1.18.0

func (si *ServiceInstances) UpdateProtectThreshold(protectThreshold float32)

func (*ServiceInstances) UpsertInstance added in v1.18.0

func (si *ServiceInstances) UpsertInstance(ins *Instance)

type ServiceKey

type ServiceKey struct {
	Namespace string
	Name      string
}

ServiceKey 服务名

func (*ServiceKey) Domain added in v1.18.0

func (s *ServiceKey) Domain() string

func (*ServiceKey) Equal added in v1.17.3

func (s *ServiceKey) Equal(o *ServiceKey) bool

func (*ServiceKey) IsExact added in v1.17.3

func (s *ServiceKey) IsExact() bool

type ServicePort added in v1.17.3

type ServicePort struct {
	Port     uint32
	Protocol string
}

type ServiceWithCircuitBreaker

type ServiceWithCircuitBreaker struct {
	ServiceID      string
	CircuitBreaker *CircuitBreaker
	Valid          bool
	CreateTime     time.Time
	ModifyTime     time.Time
}

ServiceWithCircuitBreaker 与服务关系绑定的熔断规则

type ServiceWithCircuitBreakerRules added in v1.14.0

type ServiceWithCircuitBreakerRules struct {
	Service ServiceKey

	Revision string
	// contains filtered or unexported fields
}

ServiceWithCircuitBreakerRules 与服务关系绑定的熔断规则

func NewServiceWithCircuitBreakerRules added in v1.14.0

func NewServiceWithCircuitBreakerRules(svcKey ServiceKey) *ServiceWithCircuitBreakerRules

func (*ServiceWithCircuitBreakerRules) AddCircuitBreakerRule added in v1.14.0

func (s *ServiceWithCircuitBreakerRules) AddCircuitBreakerRule(rule *CircuitBreakerRule)

func (*ServiceWithCircuitBreakerRules) Clear added in v1.14.0

func (s *ServiceWithCircuitBreakerRules) Clear()

func (*ServiceWithCircuitBreakerRules) CountCircuitBreakerRules added in v1.14.0

func (s *ServiceWithCircuitBreakerRules) CountCircuitBreakerRules() int

func (*ServiceWithCircuitBreakerRules) DelCircuitBreakerRule added in v1.14.0

func (s *ServiceWithCircuitBreakerRules) DelCircuitBreakerRule(id string)

func (*ServiceWithCircuitBreakerRules) IterateCircuitBreakerRules added in v1.14.0

func (s *ServiceWithCircuitBreakerRules) IterateCircuitBreakerRules(callback func(*CircuitBreakerRule))

type ServiceWithFaultDetectRules added in v1.14.0

type ServiceWithFaultDetectRules struct {
	Service ServiceKey

	Revision string
	// contains filtered or unexported fields
}

ServiceWithFaultDetectRules 与服务关系绑定的探测规则

func NewServiceWithFaultDetectRules added in v1.14.0

func NewServiceWithFaultDetectRules(svcKey ServiceKey) *ServiceWithFaultDetectRules

func (*ServiceWithFaultDetectRules) AddFaultDetectRule added in v1.14.0

func (s *ServiceWithFaultDetectRules) AddFaultDetectRule(rule *FaultDetectRule)

func (*ServiceWithFaultDetectRules) Clear added in v1.14.0

func (s *ServiceWithFaultDetectRules) Clear()

func (*ServiceWithFaultDetectRules) CountFaultDetectRules added in v1.14.0

func (s *ServiceWithFaultDetectRules) CountFaultDetectRules() int

func (*ServiceWithFaultDetectRules) DelFaultDetectRule added in v1.14.0

func (s *ServiceWithFaultDetectRules) DelFaultDetectRule(id string)

func (*ServiceWithFaultDetectRules) IterateFaultDetectRules added in v1.14.0

func (s *ServiceWithFaultDetectRules) IterateFaultDetectRules(callback func(*FaultDetectRule))

type Sid

type Sid struct {
	ModID uint32
	CmdID uint32
}

Sid sid信息

func UnmarshalSid added in v1.17.3

func UnmarshalSid(sidStr string) (*Sid, error)

UnmarshalSid 把sid字符串反序列化为结构体Sid

type SidConfig

type SidConfig struct {
	ModID  uint32
	CmdID  uint32
	Name   string
	Policy uint32
}

SidConfig sid信息,对应t_sid表

type SimpleConfigFileRelease added in v1.17.3

type SimpleConfigFileRelease struct {
	*ConfigFileReleaseKey
	Version            uint64
	Comment            string
	Md5                string
	Flag               int
	Active             bool
	Valid              bool
	Format             string
	Metadata           map[string]string
	CreateTime         time.Time
	CreateBy           string
	ModifyTime         time.Time
	ModifyBy           string
	ReleaseDescription string
	BetaLabels         []*apimodel.ClientLabel
}

SimpleConfigFileRelease 配置文件发布数据持久化对象

func (*SimpleConfigFileRelease) GetEncryptAlgo added in v1.17.3

func (s *SimpleConfigFileRelease) GetEncryptAlgo() string

func (*SimpleConfigFileRelease) GetEncryptDataKey added in v1.17.3

func (s *SimpleConfigFileRelease) GetEncryptDataKey() string

func (*SimpleConfigFileRelease) IsEncrypted added in v1.17.3

func (s *SimpleConfigFileRelease) IsEncrypted() bool

func (*SimpleConfigFileRelease) ToSpecNotifyClientRequest added in v1.18.0

func (s *SimpleConfigFileRelease) ToSpecNotifyClientRequest() *config_manage.ClientConfigFileInfo

type Strategy

type Strategy struct {
	ID         string
	Name       string
	Principal  string
	Action     string
	Comment    string
	Owner      string
	Default    bool
	Valid      bool
	CreateTime time.Time
	ModifyTime time.Time
}

Strategy 策略main信息

type StrategyDetail

type StrategyDetail struct {
	ID         string
	Name       string
	Action     string
	Comment    string
	Principals []Principal
	Default    bool
	Owner      string
	Resources  []StrategyResource
	Valid      bool
	Revision   string
	CreateTime time.Time
	ModifyTime time.Time
}

StrategyDetail 鉴权策略详细

type StrategyDetailCache

type StrategyDetailCache struct {
	*StrategyDetail
	UserPrincipal  map[string]Principal
	GroupPrincipal map[string]Principal
}

StrategyDetailCache 鉴权策略详细

type StrategyResource

type StrategyResource struct {
	StrategyID string
	ResType    int32
	ResID      string
}

StrategyResource 策略资源

type User

type User struct {
	ID          string
	Name        string
	Password    string
	Owner       string
	Source      string
	Mobile      string
	Email       string
	Type        UserRoleType
	Token       string
	TokenEnable bool
	Valid       bool
	Comment     string
	CreateTime  time.Time
	ModifyTime  time.Time
}

User 用户

type UserGroup

type UserGroup struct {
	ID          string
	Name        string
	Owner       string
	Token       string
	TokenEnable bool
	Valid       bool
	Comment     string
	CreateTime  time.Time
	ModifyTime  time.Time
}

UserGroup 用户组

type UserGroupDetail

type UserGroupDetail struct {
	*UserGroup

	// UserIds改为 map 的形式,加速查询
	UserIds map[string]struct{}
}

UserGroupDetail 用户组详细(带用户列表)

func (*UserGroupDetail) ToUserIdSlice

func (ugd *UserGroupDetail) ToUserIdSlice() []string

ToUserIdSlice 将用户ID Map 专为 slice

type UserGroupRelation

type UserGroupRelation struct {
	GroupID    string
	UserIds    []string
	CreateTime time.Time
	ModifyTime time.Time
}

UserGroupRelation 用户-用户组关联关系具体信息

type UserRoleType

type UserRoleType int

UserRoleType 用户角色类型

const (
	UnknownUserRole    UserRoleType = -1
	AdminUserRole      UserRoleType = 0
	OwnerUserRole      UserRoleType = 20
	SubAccountUserRole UserRoleType = 50
)

type WeightType

type WeightType uint32

WeightType 服务下实例的权重类型

const (
	// WEIGHTDYNAMIC 动态权重
	WEIGHTDYNAMIC WeightType = iota

	// WEIGHTSTATIC 静态权重
	WEIGHTSTATIC
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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