Documentation ¶
Index ¶
- Constants
- Variables
- func Api2RoutingConfigV2(req *apitraffic.RouteRule) (*model.RouterConfig, error)
- func CheckDbInstanceFieldLen(req *apiservice.Instance) (*apiservice.Response, bool)
- func CheckDbServiceAliasFieldLen(req *apiservice.ServiceAlias) (*apiservice.Response, bool)
- func CheckDbServiceFieldLen(req *apiservice.Service) (*apiservice.Response, bool)
- func ComputeNamespace(modID uint32, cmdID uint32) []string
- func CreateCl5SidList(sidConfigs []*model.SidConfig) *l5.Cl5SidList
- func Initialize(ctx context.Context, namingOpt *Config, opts ...InitOption) error
- func ParseIPInt2Str(ip uint32) string
- func ParseIPStr2Int(ip string) (uint32, error)
- func ParseIPStr2IntV2(ip string) uint32
- func ParseInstanceArgs(query map[string]string, meta map[string]string) (*store.InstanceArgs, error)
- func ParseSetID(str string) []string
- func ParseWeight(str string) []uint32
- func TestCheckCreateInstance(req *apiservice.Instance) (string, *apiservice.Response)
- func TestInitialize(ctx context.Context, namingOpt *Config, cacheOpt *cache.Config, ...) (DiscoverServer, DiscoverServer, error)
- func TestIsEmptyLocation(loc *apimodel.Location) bool
- type BaseInstanceEventHandler
- type CircuitBreakerOperateServer
- type Client2Api
- type ClientServer
- type Config
- type DiscoverServer
- type DiscoverServerV1
- type FaultDetectRuleOperateServer
- type InitOption
- func WithBatchController(c *batch.Controller) InitOption
- func WithCacheManager(cacheOpt *cache.Config, c *cache.CacheManager) InitOption
- func WithHealthCheckSvr(svr *healthcheck.Server) InitOption
- func WithHiddenService(c map[model.ServiceKey]struct{}) InitOption
- func WithNamespaceSvr(svr namespace.NamespaceOperateServer) InitOption
- func WithStorage(storage store.Store) InitOption
- type InstanceOperateServer
- type L5OperateServer
- type PluginInstanceEventHandler
- type RateLimitOperateServer
- type ReportClientOperateServer
- type ResourceEvent
- type ResourceHook
- type RouteRuleOperateServer
- type RouterRuleOperateServer
- type Server
- func (s *Server) Cache() *cache.CacheManager
- func (s *Server) CreateCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse
- func (s *Server) CreateCircuitBreakerVersions(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse
- func (s *Server) CreateCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse
- func (s *Server) CreateFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse
- func (s *Server) CreateInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
- func (s *Server) CreateInstances(ctx context.Context, reqs []*apiservice.Instance) *apiservice.BatchWriteResponse
- func (s *Server) CreateRateLimit(ctx context.Context, req *apitraffic.Rule) *apiservice.Response
- func (s *Server) CreateRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse
- func (s *Server) CreateRoutingConfig(ctx context.Context, req *apitraffic.Routing) *apiservice.Response
- func (s *Server) CreateRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse
- func (s *Server) CreateRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse
- func (s *Server) CreateService(ctx context.Context, req *apiservice.Service) *apiservice.Response
- func (s *Server) CreateServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response
- func (s *Server) CreateServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse
- func (s *Server) DeleteCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse
- func (s *Server) DeleteCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse
- func (s *Server) DeleteFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse
- func (s *Server) DeleteInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
- func (s *Server) DeleteInstanceByHost(ctx context.Context, req *apiservice.Instance) *apiservice.Response
- func (s *Server) DeleteInstances(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse
- func (s *Server) DeleteInstancesByHost(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse
- func (s *Server) DeleteRateLimit(ctx context.Context, req *apitraffic.Rule) *apiservice.Response
- func (s *Server) DeleteRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse
- func (s *Server) DeleteRoutingConfig(ctx context.Context, req *apitraffic.Routing) *apiservice.Response
- func (s *Server) DeleteRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse
- func (s *Server) DeleteRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse
- func (s *Server) DeleteService(ctx context.Context, req *apiservice.Service) *apiservice.Response
- func (s *Server) DeleteServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response
- func (s *Server) DeleteServiceAliases(ctx context.Context, req []*apiservice.ServiceAlias) *apiservice.BatchWriteResponse
- func (s *Server) DeleteServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse
- func (s *Server) DeregisterInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
- func (s *Server) EnableCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse
- func (s *Server) EnableRateLimit(ctx context.Context, req *apitraffic.Rule) *apiservice.Response
- func (s *Server) EnableRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse
- func (s *Server) EnableRoutings(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse
- func (s *Server) GetAllServices(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetBatchController() *batch.Controller
- func (s *Server) GetCircuitBreaker(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetCircuitBreakerByService(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetCircuitBreakerRules(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetCircuitBreakerToken(ctx context.Context, req *apifault.CircuitBreaker) *apiservice.Response
- func (s *Server) GetCircuitBreakerVersions(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetCircuitBreakerWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
- func (s *Server) GetFaultDetectRules(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetFaultDetectWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
- func (s *Server) GetInstanceLabels(ctx context.Context, query map[string]string) *apiservice.Response
- func (s *Server) GetInstances(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetInstancesCount(ctx context.Context) *apiservice.BatchQueryResponse
- func (s *Server) GetMasterCircuitBreakers(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetPrometheusTargets(ctx context.Context, query map[string]string) *model.PrometheusDiscoveryResponse
- func (s *Server) GetRateLimitWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
- func (s *Server) GetRateLimits(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetReleaseCircuitBreakers(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetReportClients(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetRoutingConfigWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
- func (s *Server) GetRoutingConfigs(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetServiceAliases(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetServiceInstanceRevision(serviceID string, instances []*model.Instance) (string, error)
- func (s *Server) GetServiceOwner(ctx context.Context, req []*apiservice.Service) *apiservice.BatchQueryResponse
- func (s *Server) GetServiceToken(ctx context.Context, req *apiservice.Service) *apiservice.Response
- func (s *Server) GetServiceWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
- func (s *Server) GetServices(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) GetServicesCount(ctx context.Context) *apiservice.BatchQueryResponse
- func (s *Server) HealthServer() *healthcheck.Server
- func (s *Server) MockBatchController(bc *batch.Controller)
- func (s *Server) Namespace() namespace.NamespaceOperateServer
- func (s *Server) QueryRoutingConfigsV2(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
- func (s *Server) RecordDiscoverStatis(service, discoverNamespace string)
- func (s *Server) RecordHistory(ctx context.Context, entry *model.RecordEntry)
- func (s *Server) RegisterByNameCmd(rbnc *l5.Cl5RegisterByNameCmd) (*l5.Cl5RegisterByNameAckCmd, error)
- func (s *Server) RegisterInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
- func (s *Server) ReleaseCircuitBreakers(ctx context.Context, req []*apiservice.ConfigRelease) *apiservice.BatchWriteResponse
- func (s *Server) ReportClient(ctx context.Context, req *apiservice.Client) *apiservice.Response
- func (s *Server) ServiceInstancesCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
- func (s *Server) SetResourceHooks(hooks ...ResourceHook)
- func (s *Server) SyncByAgentCmd(ctx context.Context, sbac *l5.Cl5SyncByAgentCmd) (*l5.Cl5SyncByAgentAckCmd, error)
- func (s *Server) TestSerialCreateInstance(ctx context.Context, svcId string, req *apiservice.Instance, ...) (*model.Instance, *apiservice.Response)
- func (s *Server) UnBindCircuitBreakers(ctx context.Context, req []*apiservice.ConfigRelease) *apiservice.BatchWriteResponse
- func (s *Server) UpdateCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse
- func (s *Server) UpdateCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse
- func (s *Server) UpdateFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse
- func (s *Server) UpdateInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
- func (s *Server) UpdateInstanceIsolate(ctx context.Context, req *apiservice.Instance) *apiservice.Response
- func (s *Server) UpdateInstances(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse
- func (s *Server) UpdateInstancesIsolate(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse
- func (s *Server) UpdateRateLimit(ctx context.Context, req *apitraffic.Rule) *apiservice.Response
- func (s *Server) UpdateRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse
- func (s *Server) UpdateRoutingConfig(ctx context.Context, req *apitraffic.Routing) *apiservice.Response
- func (s *Server) UpdateRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse
- func (s *Server) UpdateRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse
- func (s *Server) UpdateService(ctx context.Context, req *apiservice.Service) *apiservice.Response
- func (s *Server) UpdateServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response
- func (s *Server) UpdateServiceToken(ctx context.Context, req *apiservice.Service) *apiservice.Response
- func (s *Server) UpdateServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse
- type Service2Api
- type ServiceAliasOperateServer
- type ServiceOperateServer
Constants ¶
const ( // MaxBatchSize max batch size MaxBatchSize = 100 // MaxQuerySize max query size MaxQuerySize = 100 )
const ( // SystemNamespace polaris system namespace SystemNamespace = "Polaris" // DefaultNamespace default namespace DefaultNamespace = "default" // ProductionNamespace default namespace ProductionNamespace = "Production" // DefaultTLL default ttl DefaultTLL = 5 )
const ( // QueryDefaultOffset default query offset QueryDefaultOffset = 0 // QueryDefaultLimit default query limit QueryDefaultLimit = 100 // QueryMaxLimit default query max QueryMaxLimit = 100 // MaxMetadataLength metadata max length MaxMetadataLength = 64 MaxBusinessLength = 64 MaxOwnersLength = 1024 MaxDepartmentLength = 1024 MaxCommentLength = 1024 // service表 MaxDbServiceNameLength = 128 MaxDbServiceNamespaceLength = 64 MaxDbServicePortsLength = 8192 MaxDbServiceBusinessLength = 128 MaxDbServiceDeptLength = 1024 MaxDbServiceCMDBLength = 1024 MaxDbServiceCommentLength = 1024 MaxDbServiceOwnerLength = 1024 MaxDbServiceToken = 2048 // instance表 MaxDbInsHostLength = 128 MaxDbInsProtocolLength = 32 MaxDbInsVersionLength = 32 MaxDbInsLogicSetLength = 128 // circuitbreaker表 MaxDbCircuitbreakerName = 128 MaxDbCircuitbreakerNamespace = 64 MaxDbCircuitbreakerBusiness = 64 MaxDbCircuitbreakerDepartment = 1024 MaxDbCircuitbreakerComment = 1024 MaxDbCircuitbreakerOwner = 1024 MaxDbCircuitbreakerVersion = 32 // platform表 MaxPlatformIDLength = 32 MaxPlatformNameLength = 128 MaxPlatformDomainLength = 1024 MaxPlatformQPS = 65535 MaxRuleName = 64 // ratelimit表 MaxDbRateLimitName = MaxRuleName // MaxDbRoutingName routing_config_v2 表 MaxDbRoutingName = MaxRuleName // ContextDiscoverParam key for discover parameters in context ContextDiscoverParam = utils.StringContext("discover-param") // ParamKeyInstanceId key for parameter key instanceId ParamKeyInstanceId = "instanceId" )
some options config
const (
MetadataInternalAutoCreated string = "internal-auto-created"
)
Variables ¶
var ( // InstanceFilterAttributes 查询实例支持的过滤字段 InstanceFilterAttributes = map[string]bool{ "id": true, "service": true, "namespace": true, "host": true, "port": true, "keys": true, "values": true, "protocol": true, "version": true, "health_status": true, "healthy": true, "isolate": true, "weight": true, "logic_set": true, "cmdb_region": true, "cmdb_zone": true, "cmdb_idc": true, "priority": true, "offset": true, "limit": true, } // InsFilter2toreAttr 查询字段转为存储层的属性值,映射表 InsFilter2toreAttr = map[string]string{ "service": "name", "healthy": "health_status", } // NotInsFilterAttr 不属于 instance 表属性的字段 NotInsFilterAttr = map[string]bool{ "keys": true, "values": true, } )
var ( // Namespace2SidLayoutID namespace to sid layout id Namespace2SidLayoutID = map[string]uint32{ "Production": 1, "Development": 2, "Pre-release": 3, "Test": 4, "Polaris": 5, "default": 6, } // SidLayoutID2Namespace sid layout id to namespace SidLayoutID2Namespace = map[uint32]string{ 1: "Production", 2: "Development", 3: "Pre-release", 4: "Test", 5: "Polaris", 6: "default", } )
var ( // AliasFilterAttributes filer attrs alias AliasFilterAttributes = map[string]bool{ "alias": true, "alias_namespace": true, "namespace": true, "service": true, "owner": true, "offset": true, "limit": true, } )
var ( // CircuitBreakerRuleFilters filter circuitbreaker rule query parameters CircuitBreakerRuleFilters = map[string]bool{ "brief": true, "offset": true, "limit": true, "id": true, "name": true, "namespace": true, "enable": true, "level": true, "service": true, "serviceNamespace": true, "srcService": true, "srcNamespace": true, "dstService": true, "dstNamespace": true, "dstMethod": true, "description": true, } )
var ( // FaultDetectRuleFilters filter fault detect rule query parameters FaultDetectRuleFilters = map[string]bool{ "brief": true, "offset": true, "limit": true, "id": true, "name": true, "namespace": true, "service": true, "serviceNamespace": true, "dstService": true, "dstNamespace": true, "dstMethod": true, "description": true, } )
var ( // RateLimitFilters rate limit filters RateLimitFilters = map[string]bool{ "id": true, "name": true, "service": true, "namespace": true, "brief": true, "method": true, "labels": true, "disable": true, "offset": true, "limit": true, } )
var ( // RoutingConfigFilterAttrs router config filter attrs RoutingConfigFilterAttrs = map[string]bool{ "service": true, "namespace": true, "offset": true, "limit": true, } )
var ( // RoutingConfigV2FilterAttrs router config filter attrs RoutingConfigV2FilterAttrs = map[string]bool{ "id": true, "name": true, "service": true, "namespace": true, "source_service": true, "destination_service": true, "source_namespace": true, "destination_namespace": true, "enable": true, "offset": true, "limit": true, "order_field": true, "order_type": true, } )
var (
ServiceFilterAttributes = map[string]int{
"name": serviceFilter,
"namespace": serviceFilter,
"business": serviceFilter,
"department": serviceFilter,
"cmdb_mod1": serviceFilter,
"cmdb_mod2": serviceFilter,
"cmdb_mod3": serviceFilter,
"owner": serviceFilter,
"offset": serviceFilter,
"limit": serviceFilter,
"platform_id": serviceFilter,
"host": instanceFilter,
"port": instanceFilter,
"keys": serviceMetaFilter,
"values": serviceMetaFilter,
"instance_keys": instanceMetaFilter,
"instance_values": instanceMetaFilter,
}
)
Functions ¶
func Api2RoutingConfigV2 ¶ added in v1.15.1
func Api2RoutingConfigV2(req *apitraffic.RouteRule) (*model.RouterConfig, error)
Api2RoutingConfigV2 Convert the API parameter to internal data structure
func CheckDbInstanceFieldLen ¶
func CheckDbInstanceFieldLen(req *apiservice.Instance) (*apiservice.Response, bool)
CheckDbInstanceFieldLen 检查DB中service表对应的入参字段合法性
func CheckDbServiceAliasFieldLen ¶
func CheckDbServiceAliasFieldLen(req *apiservice.ServiceAlias) (*apiservice.Response, bool)
CheckDbServiceAliasFieldLen 检查DB中service表对应的入参字段合法性
func CheckDbServiceFieldLen ¶
func CheckDbServiceFieldLen(req *apiservice.Service) (*apiservice.Response, bool)
CheckDbServiceFieldLen 检查DB中service表对应的入参字段合法性
func ComputeNamespace ¶
ComputeNamespace 根据SID分析,返回其对应的namespace
func CreateCl5SidList ¶
func CreateCl5SidList(sidConfigs []*model.SidConfig) *l5.Cl5SidList
CreateCl5SidList 构造sidConfigs
func Initialize ¶
func Initialize(ctx context.Context, namingOpt *Config, opts ...InitOption) error
Initialize 初始化
func ParseIPStr2Int ¶
ParseIPStr2Int 字符串IP转为uint32 转换失败的,需要明确错误
func ParseInstanceArgs ¶
func ParseInstanceArgs(query map[string]string, meta map[string]string) (*store.InstanceArgs, error)
ParseInstanceArgs 解析服务实例的 ip 和 port 查询参数
func TestCheckCreateInstance ¶ added in v1.15.1
func TestCheckCreateInstance(req *apiservice.Instance) (string, *apiservice.Response)
TestCheckCreateInstance .
func TestInitialize ¶
func TestInitialize(ctx context.Context, namingOpt *Config, cacheOpt *cache.Config, bc *batch.Controller, cacheMgr *cache.CacheManager, storage store.Store, namespaceSvr namespace.NamespaceOperateServer, healthSvr *healthcheck.Server, userMgn auth.UserServer, strategyMgn auth.StrategyServer) (DiscoverServer, DiscoverServer, error)
TestInitialize 初始化
func TestIsEmptyLocation ¶ added in v1.15.1
TestIsEmptyLocation .
Types ¶
type BaseInstanceEventHandler ¶ added in v1.15.0
type BaseInstanceEventHandler struct {
// contains filtered or unexported fields
}
func NewBaseInstanceEventHandler ¶ added in v1.15.0
func NewBaseInstanceEventHandler(namingServer DiscoverServer) *BaseInstanceEventHandler
func (*BaseInstanceEventHandler) PreProcess ¶ added in v1.15.0
func (b *BaseInstanceEventHandler) PreProcess(ctx context.Context, value any) any
PreProcess do preprocess logic for event
type CircuitBreakerOperateServer ¶
type CircuitBreakerOperateServer interface { // CreateCircuitBreakers Create a CircuitBreaker rule // Deprecated: not support from 1.14.x CreateCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse // CreateCircuitBreakerVersions Create a melt rule version // Deprecated: not support from 1.14.x CreateCircuitBreakerVersions(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse // DeleteCircuitBreakers Delete CircuitBreaker rules // Deprecated: not support from 1.14.x DeleteCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse // UpdateCircuitBreakers Modify the CircuitBreaker rule // Deprecated: not support from 1.14.x UpdateCircuitBreakers(ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse // ReleaseCircuitBreakers Release CircuitBreaker rule // Deprecated: not support from 1.14.x ReleaseCircuitBreakers(ctx context.Context, req []*apiservice.ConfigRelease) *apiservice.BatchWriteResponse // UnBindCircuitBreakers Solution CircuitBreaker rule // Deprecated: not support from 1.14.x UnBindCircuitBreakers(ctx context.Context, req []*apiservice.ConfigRelease) *apiservice.BatchWriteResponse // GetCircuitBreaker Get CircuitBreaker regular according to ID and VERSION // Deprecated: not support from 1.14.x GetCircuitBreaker(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // GetCircuitBreakerVersions Query all versions of the CircuitBreaker rule // Deprecated: not support from 1.14.x GetCircuitBreakerVersions(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // GetMasterCircuitBreakers Query Master CircuitBreaker rules // Deprecated: not support from 1.14.x GetMasterCircuitBreakers(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // GetReleaseCircuitBreakers Query the released CircuitBreaker rule according to the rule ID // Deprecated: not support from 1.14.x GetReleaseCircuitBreakers(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // GetCircuitBreakerByService Binding CircuitBreaker rule based on service query // Deprecated: not support from 1.14.x GetCircuitBreakerByService(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // GetCircuitBreakerToken Get CircuitBreaker rules token // Deprecated: not support from 1.14.x GetCircuitBreakerToken(ctx context.Context, req *apifault.CircuitBreaker) *apiservice.Response // CreateCircuitBreakerRules Create a CircuitBreaker rule CreateCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse // DeleteCircuitBreakerRules Delete current CircuitBreaker rules DeleteCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse // EnableCircuitBreakerRules Enable the CircuitBreaker rule EnableCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse // UpdateCircuitBreakerRules Modify the CircuitBreaker rule UpdateCircuitBreakerRules(ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse // GetCircuitBreakerRules Query CircuitBreaker rules GetCircuitBreakerRules(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse }
CircuitBreakerOperateServer Melting rule related treatment
type Client2Api ¶
type Client2Api func(client *model.Client) *apiservice.Client
type ClientServer ¶
type ClientServer interface { // RegisterInstance create one instance by client RegisterInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response // DeregisterInstance delete onr instance by client DeregisterInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response // ReportClient Client gets geographic location information ReportClient(ctx context.Context, req *apiservice.Client) *apiservice.Response // GetPrometheusTargets Used to obtain the ReportClient information and serve as the SD result of Prometheus GetPrometheusTargets(ctx context.Context, query map[string]string) *model.PrometheusDiscoveryResponse // GetServiceWithCache Used for client acquisition service information GetServiceWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse // ServiceInstancesCache Used for client acquisition service instance information ServiceInstancesCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse // GetRoutingConfigWithCache User Client Get Service Routing Configuration Information GetRoutingConfigWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse // GetRateLimitWithCache User Client Get Service Limit Configuration Information GetRateLimitWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse // GetCircuitBreakerWithCache Fuse configuration information for obtaining services for clients GetCircuitBreakerWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse // GetFaultDetectWithCache User Client Get FaultDetect Rule Information GetFaultDetectWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse // UpdateInstance update one instance by client UpdateInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response }
ClientServer Client related operation Client operation interface definition
type Config ¶
type Config struct { Auth map[string]interface{} `yaml:"auth"` Batch map[string]interface{} `yaml:"batch"` }
Config 核心逻辑层配置
type DiscoverServer ¶
type DiscoverServer interface { // DiscoverServerV1 DiscoverServerV1 DiscoverServerV1 // ServiceAliasOperateServer Service alias operation interface definition ServiceAliasOperateServer // ServiceOperateServer Service operation interface definition ServiceOperateServer // InstanceOperateServer Instance Operation Interface Definition InstanceOperateServer // ClientServer Client operation interface definition ClientServer // Cache Get cache management Cache() *cache.CacheManager // L5OperateServer L5 related operations L5OperateServer // GetServiceInstanceRevision Get the version of the service GetServiceInstanceRevision(serviceID string, instances []*model.Instance) (string, error) }
DiscoverServer Server discovered by the service
type DiscoverServerV1 ¶
type DiscoverServerV1 interface { // CircuitBreakerOperateServer Fuse rule operation interface definition CircuitBreakerOperateServer // RateLimitOperateServer Lamflow rule operation interface definition RateLimitOperateServer // RouteRuleOperateServer Routing rules operation interface definition RouteRuleOperateServer // RouterRuleOperateServer Routing rules operation interface definition RouterRuleOperateServer // FaultDetectRuleOperateServer fault detect rules operation interface definition FaultDetectRuleOperateServer }
type FaultDetectRuleOperateServer ¶ added in v1.14.0
type FaultDetectRuleOperateServer interface { // CreateFaultDetectRules create the fault detect rule by request CreateFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse // DeleteFaultDetectRules delete the fault detect rule by request DeleteFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse // UpdateFaultDetectRules update the fault detect rule by request UpdateFaultDetectRules(ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse // GetFaultDetectRules get the fault detect rule by request GetFaultDetectRules(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse }
FaultDetectRuleOperateServer Fault detect rules related operations
type InitOption ¶
type InitOption func(s *Server)
func WithBatchController ¶
func WithBatchController(c *batch.Controller) InitOption
func WithCacheManager ¶
func WithCacheManager(cacheOpt *cache.Config, c *cache.CacheManager) InitOption
func WithHealthCheckSvr ¶
func WithHealthCheckSvr(svr *healthcheck.Server) InitOption
func WithHiddenService ¶
func WithHiddenService(c map[model.ServiceKey]struct{}) InitOption
func WithNamespaceSvr ¶
func WithNamespaceSvr(svr namespace.NamespaceOperateServer) InitOption
func WithStorage ¶
func WithStorage(storage store.Store) InitOption
type InstanceOperateServer ¶
type InstanceOperateServer interface { // CreateInstances Batch creation instance CreateInstances(ctx context.Context, reqs []*apiservice.Instance) *apiservice.BatchWriteResponse // DeleteInstances Batch delete instance DeleteInstances(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse // DeleteInstancesByHost Delete instance according to HOST information batch DeleteInstancesByHost(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse // UpdateInstances Batch update instance UpdateInstances(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse // UpdateInstancesIsolate Batch update instance isolation state UpdateInstancesIsolate(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse // GetInstances Get an instance list GetInstances(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // GetInstancesCount Get an instance quantity GetInstancesCount(ctx context.Context) *apiservice.BatchQueryResponse // GetInstanceLabels Get an instance tag under a service GetInstanceLabels(ctx context.Context, query map[string]string) *apiservice.Response }
InstanceOperateServer Example related operations
type L5OperateServer ¶
type L5OperateServer interface { // SyncByAgentCmd Get routing information according to SID list SyncByAgentCmd(ctx context.Context, sbac *l5.Cl5SyncByAgentCmd) (*l5.Cl5SyncByAgentAckCmd, error) // RegisterByNameCmd Look for the corresponding SID list according to the list of service names RegisterByNameCmd(rbnc *l5.Cl5RegisterByNameCmd) (*l5.Cl5RegisterByNameAckCmd, error) }
L5OperateServer L5 related operations
type PluginInstanceEventHandler ¶ added in v1.15.0
type PluginInstanceEventHandler struct { *BaseInstanceEventHandler // contains filtered or unexported fields }
type RateLimitOperateServer ¶
type RateLimitOperateServer interface { // CreateRateLimits Create a RateLimit rule CreateRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse // DeleteRateLimits Delete current RateLimit rules DeleteRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse // EnableRateLimits Enable the RateLimit rule EnableRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse // UpdateRateLimits Modify the RateLimit rule UpdateRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse // GetRateLimits Query RateLimit rules GetRateLimits(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse }
RateLimitOperateServer Lamflow rule related operation
type ReportClientOperateServer ¶
type ReportClientOperateServer interface { // GetReportClients Query the client information reported GetReportClients(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse }
ReportClientOperateServer Report information operation interface on the client
type ResourceEvent ¶
type ResourceEvent struct { ReqService *apiservice.Service Service *model.Service IsRemove bool }
ResourceEvent 资源事件
type ResourceHook ¶
type ResourceHook interface { // Before // @param ctx // @param resourceType Before(ctx context.Context, resourceType model.Resource) // After // @param ctx // @param resourceType // @param res After(ctx context.Context, resourceType model.Resource, res *ResourceEvent) error }
ResourceHook The listener is placed before and after the resource operation, only normal flow
type RouteRuleOperateServer ¶
type RouteRuleOperateServer interface { // CreateRoutingConfigs Batch creation routing configuration CreateRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse // DeleteRoutingConfigs Batch delete routing configuration DeleteRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse // UpdateRoutingConfigs Batch update routing configuration UpdateRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse // GetRoutingConfigs Inquiry route configuration to OSS GetRoutingConfigs(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse }
RouteRuleOperateServer Routing rules related operations
type RouterRuleOperateServer ¶ added in v1.14.0
type RouterRuleOperateServer interface { // CreateRoutingConfigsV2 Batch creation routing configuration CreateRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse // DeleteRoutingConfigsV2 Batch delete routing configuration DeleteRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse // UpdateRoutingConfigsV2 Batch update routing configuration UpdateRoutingConfigsV2(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse // QueryRoutingConfigsV2 Inquiry route configuration to OSS QueryRoutingConfigsV2(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // EnableRoutings batch enable routing rules EnableRoutings(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse }
RouterRuleOperateServer Routing rules related operations
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server 对接API层的server层,用以处理业务逻辑
func TestNewServer ¶ added in v1.15.1
func TestNewServer(mockStore store.Store, nsSvr namespace.NamespaceOperateServer, cacheMgr *cache.CacheManager) *Server
func (*Server) CreateCircuitBreakerRules ¶ added in v1.14.0
func (s *Server) CreateCircuitBreakerRules( ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse
CreateCircuitBreakerRules Create a CircuitBreaker rule
func (*Server) CreateCircuitBreakerVersions ¶
func (s *Server) CreateCircuitBreakerVersions( ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse
CreateCircuitBreakerVersions 批量创建熔断规则版本
func (*Server) CreateCircuitBreakers ¶
func (s *Server) CreateCircuitBreakers( ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse
CreateCircuitBreakers 批量创建熔断规则
func (*Server) CreateFaultDetectRules ¶ added in v1.14.0
func (s *Server) CreateFaultDetectRules( ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse
CreateFaultDetectRules Create a FaultDetect rule
func (*Server) CreateInstance ¶
func (s *Server) CreateInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
CreateInstance create a single service instance
func (*Server) CreateInstances ¶
func (s *Server) CreateInstances(ctx context.Context, reqs []*apiservice.Instance) *apiservice.BatchWriteResponse
CreateInstances 批量创建服务实例
func (*Server) CreateRateLimit ¶
func (s *Server) CreateRateLimit(ctx context.Context, req *apitraffic.Rule) *apiservice.Response
CreateRateLimit 创建限流规则
func (*Server) CreateRateLimits ¶
func (s *Server) CreateRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse
CreateRateLimits 批量创建限流规则
func (*Server) CreateRoutingConfig ¶
func (s *Server) CreateRoutingConfig(ctx context.Context, req *apitraffic.Routing) *apiservice.Response
CreateRoutingConfig Create a routing configuration, Creating route configuration requires locking services to prevent the service from being deleted Deprecated: This method is ready to abandon
func (*Server) CreateRoutingConfigs ¶
func (s *Server) CreateRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse
CreateRoutingConfigs Create a routing configuration
func (*Server) CreateRoutingConfigsV2 ¶
func (s *Server) CreateRoutingConfigsV2( ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse
CreateRoutingConfigsV2 Create a routing configuration
func (*Server) CreateService ¶
func (s *Server) CreateService(ctx context.Context, req *apiservice.Service) *apiservice.Response
CreateService 创建单个服务
func (*Server) CreateServiceAlias ¶
func (s *Server) CreateServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response
CreateServiceAlias 创建服务别名
func (*Server) CreateServices ¶
func (s *Server) CreateServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse
CreateServices 批量创建服务
func (*Server) DeleteCircuitBreakerRules ¶ added in v1.14.0
func (s *Server) DeleteCircuitBreakerRules( ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse
DeleteCircuitBreakerRules Delete current CircuitBreaker rules
func (*Server) DeleteCircuitBreakers ¶
func (s *Server) DeleteCircuitBreakers( ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse
DeleteCircuitBreakers 批量删除熔断规则
func (*Server) DeleteFaultDetectRules ¶ added in v1.14.0
func (s *Server) DeleteFaultDetectRules( ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse
DeleteFaultDetectRules Delete current Fault Detect rules
func (*Server) DeleteInstance ¶
func (s *Server) DeleteInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
DeleteInstance 删除单个服务实例
func (*Server) DeleteInstanceByHost ¶
func (s *Server) DeleteInstanceByHost(ctx context.Context, req *apiservice.Instance) *apiservice.Response
DeleteInstanceByHost 根据host删除服务实例
func (*Server) DeleteInstances ¶
func (s *Server) DeleteInstances(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse
DeleteInstances 批量删除服务实例
func (*Server) DeleteInstancesByHost ¶
func (s *Server) DeleteInstancesByHost( ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse
DeleteInstancesByHost 根据host批量删除服务实例
func (*Server) DeleteRateLimit ¶
func (s *Server) DeleteRateLimit(ctx context.Context, req *apitraffic.Rule) *apiservice.Response
DeleteRateLimit 删除单个限流规则
func (*Server) DeleteRateLimits ¶
func (s *Server) DeleteRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse
DeleteRateLimits 批量删除限流规则
func (*Server) DeleteRoutingConfig ¶
func (s *Server) DeleteRoutingConfig(ctx context.Context, req *apitraffic.Routing) *apiservice.Response
DeleteRoutingConfig Delete a routing configuration Deprecated: This method is ready to abandon
func (*Server) DeleteRoutingConfigs ¶
func (s *Server) DeleteRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse
DeleteRoutingConfigs Batch delete routing configuration
func (*Server) DeleteRoutingConfigsV2 ¶
func (s *Server) DeleteRoutingConfigsV2( ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse
DeleteRoutingConfigsV2 Batch delete routing configuration
func (*Server) DeleteService ¶
func (s *Server) DeleteService(ctx context.Context, req *apiservice.Service) *apiservice.Response
DeleteService 删除单个服务
删除操作需要对服务进行加锁操作, 防止有与服务关联的实例或者配置有新增的操作
func (*Server) DeleteServiceAlias ¶
func (s *Server) DeleteServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response
DeleteServiceAlias 删除服务别名
需要带上源服务name,namespace,token 另外一种删除别名的方式,是直接调用删除服务的接口,也是可行的
func (*Server) DeleteServiceAliases ¶
func (s *Server) DeleteServiceAliases( ctx context.Context, req []*apiservice.ServiceAlias) *apiservice.BatchWriteResponse
DeleteServiceAliases 删除服务别名列表
func (*Server) DeleteServices ¶
func (s *Server) DeleteServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse
DeleteServices 批量删除服务
func (*Server) DeregisterInstance ¶
func (s *Server) DeregisterInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
DeregisterInstance delete one instance
func (*Server) EnableCircuitBreakerRules ¶ added in v1.14.0
func (s *Server) EnableCircuitBreakerRules( ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse
EnableCircuitBreakerRules Enable the CircuitBreaker rule
func (*Server) EnableRateLimit ¶
func (s *Server) EnableRateLimit(ctx context.Context, req *apitraffic.Rule) *apiservice.Response
EnableRateLimit 启用限流规则
func (*Server) EnableRateLimits ¶
func (s *Server) EnableRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse
func (*Server) EnableRoutings ¶
func (s *Server) EnableRoutings(ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse
EnableRoutings batch enable routing rules
func (*Server) GetAllServices ¶ added in v1.16.0
func (s *Server) GetAllServices(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetAllServices query all service list by namespace
func (*Server) GetBatchController ¶ added in v1.15.1
func (s *Server) GetBatchController() *batch.Controller
GetBatchController .
func (*Server) GetCircuitBreaker ¶
func (s *Server) GetCircuitBreaker(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetCircuitBreaker 根据id和version查询熔断规则
func (*Server) GetCircuitBreakerByService ¶
func (s *Server) GetCircuitBreakerByService( ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetCircuitBreakerByService 根据服务查询绑定熔断规则
func (*Server) GetCircuitBreakerRules ¶ added in v1.14.0
func (s *Server) GetCircuitBreakerRules(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetCircuitBreakerRules Query CircuitBreaker rules
func (*Server) GetCircuitBreakerToken ¶
func (s *Server) GetCircuitBreakerToken(ctx context.Context, req *apifault.CircuitBreaker) *apiservice.Response
GetCircuitBreakerToken 查询熔断规则的token
func (*Server) GetCircuitBreakerVersions ¶
func (s *Server) GetCircuitBreakerVersions( ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetCircuitBreakerVersions 根据id查询熔断规则所有版本
func (*Server) GetCircuitBreakerWithCache ¶
func (s *Server) GetCircuitBreakerWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
GetCircuitBreakerWithCache 获取缓存中的熔断规则信息
func (*Server) GetFaultDetectRules ¶ added in v1.14.0
func (s *Server) GetFaultDetectRules(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
func (*Server) GetFaultDetectWithCache ¶ added in v1.14.0
func (s *Server) GetFaultDetectWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
func (*Server) GetInstanceLabels ¶
func (s *Server) GetInstanceLabels(ctx context.Context, query map[string]string) *apiservice.Response
GetInstanceLabels 获取实例标签列表
func (*Server) GetInstances ¶
func (s *Server) GetInstances(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetInstances 查询服务实例
func (*Server) GetInstancesCount ¶
func (s *Server) GetInstancesCount(ctx context.Context) *apiservice.BatchQueryResponse
GetInstancesCount 查询总的服务实例,不带过滤条件的
func (*Server) GetMasterCircuitBreakers ¶
func (s *Server) GetMasterCircuitBreakers( ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetMasterCircuitBreakers 查询master熔断规则
func (*Server) GetPrometheusTargets ¶ added in v1.14.0
func (s *Server) GetPrometheusTargets(ctx context.Context, query map[string]string) *model.PrometheusDiscoveryResponse
GetPrometheusTargets Used for client acquisition service information
func (*Server) GetRateLimitWithCache ¶
func (s *Server) GetRateLimitWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
GetRateLimitWithCache 获取缓存中的限流规则信息
func (*Server) GetRateLimits ¶
func (s *Server) GetRateLimits(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetRateLimits 查询限流规则
func (*Server) GetReleaseCircuitBreakers ¶
func (s *Server) GetReleaseCircuitBreakers( ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetReleaseCircuitBreakers 根据规则id查询已发布规则
func (*Server) GetReportClients ¶
func (s *Server) GetReportClients(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetReportClients create one instance
func (*Server) GetRoutingConfigWithCache ¶
func (s *Server) GetRoutingConfigWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
GetRoutingConfigWithCache 获取缓存中的路由配置信息
func (*Server) GetRoutingConfigs ¶
func (s *Server) GetRoutingConfigs(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetRoutingConfigs Get the routing configuration in batches, and provide the interface of the query routing configuration to the OSS Deprecated: This method is ready to abandon
func (*Server) GetServiceAliases ¶
func (s *Server) GetServiceAliases(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetServiceAliases 查找服务别名
func (*Server) GetServiceInstanceRevision ¶
func (s *Server) GetServiceInstanceRevision(serviceID string, instances []*model.Instance) (string, error)
GetServiceInstanceRevision 获取服务实例的revision
func (*Server) GetServiceOwner ¶
func (s *Server) GetServiceOwner(ctx context.Context, req []*apiservice.Service) *apiservice.BatchQueryResponse
GetServiceOwner 查询服务负责人
func (*Server) GetServiceToken ¶
func (s *Server) GetServiceToken(ctx context.Context, req *apiservice.Service) *apiservice.Response
GetServiceToken 查询Service的token
func (*Server) GetServiceWithCache ¶
func (s *Server) GetServiceWithCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
GetServiceWithCache 查询服务列表
func (*Server) GetServices ¶
func (s *Server) GetServices(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
GetServices 查询服务 注意:不包括别名
func (*Server) GetServicesCount ¶
func (s *Server) GetServicesCount(ctx context.Context) *apiservice.BatchQueryResponse
GetServicesCount 查询服务总数
func (*Server) HealthServer ¶
func (s *Server) HealthServer() *healthcheck.Server
HealthServer 健康检查Server
func (*Server) MockBatchController ¶ added in v1.15.1
func (s *Server) MockBatchController(bc *batch.Controller)
MockBatchController .
func (*Server) Namespace ¶
func (s *Server) Namespace() namespace.NamespaceOperateServer
Namespace 返回NamespaceOperateServer
func (*Server) QueryRoutingConfigsV2 ¶ added in v1.15.0
func (s *Server) QueryRoutingConfigsV2(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse
QueryRoutingConfigsV2 The interface of the query configuration to the OSS
func (*Server) RecordDiscoverStatis ¶
RecordDiscoverStatis 打印服务发现统计
func (*Server) RecordHistory ¶
func (s *Server) RecordHistory(ctx context.Context, entry *model.RecordEntry)
RecordHistory server对外提供history插件的简单封装
func (*Server) RegisterByNameCmd ¶
func (s *Server) RegisterByNameCmd(rbnc *l5.Cl5RegisterByNameCmd) (*l5.Cl5RegisterByNameAckCmd, error)
RegisterByNameCmd 根据名字获取sid信息
func (*Server) RegisterInstance ¶
func (s *Server) RegisterInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
RegisterInstance create one instance
func (*Server) ReleaseCircuitBreakers ¶
func (s *Server) ReleaseCircuitBreakers( ctx context.Context, req []*apiservice.ConfigRelease) *apiservice.BatchWriteResponse
ReleaseCircuitBreakers 批量发布熔断规则
func (*Server) ReportClient ¶
func (s *Server) ReportClient(ctx context.Context, req *apiservice.Client) *apiservice.Response
ReportClient 客户端上报信息
func (*Server) ServiceInstancesCache ¶
func (s *Server) ServiceInstancesCache(ctx context.Context, req *apiservice.Service) *apiservice.DiscoverResponse
ServiceInstancesCache 根据服务名查询服务实例列表
func (*Server) SetResourceHooks ¶
func (s *Server) SetResourceHooks(hooks ...ResourceHook)
SetResourceHooks 设置资源操作的Hook
func (*Server) SyncByAgentCmd ¶
func (s *Server) SyncByAgentCmd(ctx context.Context, sbac *l5.Cl5SyncByAgentCmd) ( *l5.Cl5SyncByAgentAckCmd, error)
SyncByAgentCmd 根据sid获取路由信息 老函数: Stat::instance()->inc_sync_req_cnt(); 保存client的IP,该函数只是存储到本地的缓存中 Stat::instance()->add_agent(sbac.agent_ip());
func (*Server) TestSerialCreateInstance ¶ added in v1.15.1
func (s *Server) TestSerialCreateInstance( ctx context.Context, svcId string, req *apiservice.Instance, ins *apiservice.Instance) ( *model.Instance, *apiservice.Response)
TestSerialCreateInstance .
func (*Server) UnBindCircuitBreakers ¶
func (s *Server) UnBindCircuitBreakers( ctx context.Context, req []*apiservice.ConfigRelease) *apiservice.BatchWriteResponse
UnBindCircuitBreakers 批量解绑熔断规则
func (*Server) UpdateCircuitBreakerRules ¶ added in v1.14.0
func (s *Server) UpdateCircuitBreakerRules( ctx context.Context, request []*apifault.CircuitBreakerRule) *apiservice.BatchWriteResponse
UpdateCircuitBreakerRules Modify the CircuitBreaker rule
func (*Server) UpdateCircuitBreakers ¶
func (s *Server) UpdateCircuitBreakers( ctx context.Context, req []*apifault.CircuitBreaker) *apiservice.BatchWriteResponse
UpdateCircuitBreakers 批量修改熔断规则
func (*Server) UpdateFaultDetectRules ¶ added in v1.14.0
func (s *Server) UpdateFaultDetectRules( ctx context.Context, request []*apifault.FaultDetectRule) *apiservice.BatchWriteResponse
UpdateFaultDetectRules Modify the FaultDetect rule
func (*Server) UpdateInstance ¶
func (s *Server) UpdateInstance(ctx context.Context, req *apiservice.Instance) *apiservice.Response
UpdateInstance 修改单个服务实例
func (*Server) UpdateInstanceIsolate ¶
func (s *Server) UpdateInstanceIsolate(ctx context.Context, req *apiservice.Instance) *apiservice.Response
UpdateInstanceIsolate 修改服务实例隔离状态 @note 必填参数为service+namespace+ip
func (*Server) UpdateInstances ¶
func (s *Server) UpdateInstances(ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse
UpdateInstances 批量修改服务实例
func (*Server) UpdateInstancesIsolate ¶
func (s *Server) UpdateInstancesIsolate( ctx context.Context, req []*apiservice.Instance) *apiservice.BatchWriteResponse
UpdateInstancesIsolate 批量修改服务实例隔离状态 @note 必填参数为service+namespace+host
func (*Server) UpdateRateLimit ¶
func (s *Server) UpdateRateLimit(ctx context.Context, req *apitraffic.Rule) *apiservice.Response
UpdateRateLimit 更新限流规则
func (*Server) UpdateRateLimits ¶
func (s *Server) UpdateRateLimits(ctx context.Context, request []*apitraffic.Rule) *apiservice.BatchWriteResponse
UpdateRateLimits 批量更新限流规则
func (*Server) UpdateRoutingConfig ¶
func (s *Server) UpdateRoutingConfig(ctx context.Context, req *apitraffic.Routing) *apiservice.Response
UpdateRoutingConfig Update a routing configuration Deprecated: 该方法准备舍弃
func (*Server) UpdateRoutingConfigs ¶
func (s *Server) UpdateRoutingConfigs(ctx context.Context, req []*apitraffic.Routing) *apiservice.BatchWriteResponse
UpdateRoutingConfigs Batch update routing configuration
func (*Server) UpdateRoutingConfigsV2 ¶
func (s *Server) UpdateRoutingConfigsV2( ctx context.Context, req []*apitraffic.RouteRule) *apiservice.BatchWriteResponse
UpdateRoutingConfigsV2 Batch update routing configuration
func (*Server) UpdateService ¶
func (s *Server) UpdateService(ctx context.Context, req *apiservice.Service) *apiservice.Response
UpdateService 修改单个服务
func (*Server) UpdateServiceAlias ¶
func (s *Server) UpdateServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response
UpdateServiceAlias 修改服务别名
func (*Server) UpdateServiceToken ¶
func (s *Server) UpdateServiceToken(ctx context.Context, req *apiservice.Service) *apiservice.Response
UpdateServiceToken 更新服务token
func (*Server) UpdateServices ¶
func (s *Server) UpdateServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse
UpdateServices 批量修改服务
type Service2Api ¶
type Service2Api func(service *model.Service) *apiservice.Service
Service2Api *model.service转换为*api.service
type ServiceAliasOperateServer ¶
type ServiceAliasOperateServer interface { // CreateServiceAlias Create a service alias CreateServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response // DeleteServiceAliases Batch delete service alias DeleteServiceAliases(ctx context.Context, req []*apiservice.ServiceAlias) *apiservice.BatchWriteResponse // UpdateServiceAlias Update service alias UpdateServiceAlias(ctx context.Context, req *apiservice.ServiceAlias) *apiservice.Response // GetServiceAliases Get a list of service alias GetServiceAliases(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse }
ServiceAliasOperateServer Service alias related operations
type ServiceOperateServer ¶
type ServiceOperateServer interface { // CreateServices Batch creation service CreateServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse // DeleteServices Batch delete service DeleteServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse // UpdateServices Batch update service UpdateServices(ctx context.Context, req []*apiservice.Service) *apiservice.BatchWriteResponse // UpdateServiceToken Update service token UpdateServiceToken(ctx context.Context, req *apiservice.Service) *apiservice.Response // GetServices Get a list of service GetServices(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // GetAllServices Get all service list GetAllServices(ctx context.Context, query map[string]string) *apiservice.BatchQueryResponse // GetServicesCount Total number of services GetServicesCount(ctx context.Context) *apiservice.BatchQueryResponse // GetServiceToken Get service token GetServiceToken(ctx context.Context, req *apiservice.Service) *apiservice.Response // GetServiceOwner Owner for obtaining service GetServiceOwner(ctx context.Context, req []*apiservice.Service) *apiservice.BatchQueryResponse }
ServiceOperateServer Service related operations
Source Files ¶
- api.go
- api_v1.go
- circuitbreaker_config.go
- circuitbreaker_config_authability.go
- circuitbreaker_rule.go
- circuitbreaker_rule_authability.go
- client_info.go
- client_v1.go
- client_v1_authability.go
- default.go
- event.go
- faultdetect_config.go
- faultdetect_config_authability.go
- instance.go
- instance_authability.go
- l5_service.go
- l5_service_authability.go
- log.go
- options.go
- ratelimit_config.go
- ratelimit_config_authability.go
- resource_listen.go
- routing_config_v1.go
- routing_config_v1_authability.go
- routing_config_v1tov2.go
- routing_config_v2.go
- routing_config_v2_authability.go
- server.go
- server_authability.go
- service.go
- service_alias.go
- service_alias_authability.go
- service_authability.go
- test_export.go
- utils.go