Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterPlugin(name string, plugin Plugin)
- func SetPluginConfig(c *Config)
- type AddCheckRequest
- type CMDB
- type CheckRequest
- type CheckResponse
- type Config
- type ConfigEntry
- type DiscoverChannel
- type DiscoverStatis
- type HealthCheckType
- type HealthChecker
- type History
- type ParsePassword
- type Plugin
- type QueryRequest
- type QueryResponse
- type Ratelimit
- type RatelimitType
- type ReportRequest
- type Statis
- type Whitelist
Constants ¶
View Source
const ( ComponentServer = "server" ComponentRedis = "redis" ComponentProtobufCache = "protobuf" )
Variables ¶
View Source
var RatelimitStr = map[RatelimitType]string{ IPRatelimit: "ip-limit", APIRatelimit: "api-limit", ServiceRatelimit: "service-limit", InstanceRatelimit: "instance-limit", }
RatelimitStr rate limit string map
Functions ¶
Types ¶
type AddCheckRequest ¶
AddCheckRequest add check request
type CMDB ¶
type CMDB interface { Plugin // GetLocation 在CMDB中没有找到Host,返回error为nil,location为nil // 插件内部出现错误,返回error不为nil,忽略location GetLocation(host string) (*model.Location, error) // Range 提供一个Range接口,遍历所有的数据 // 遍历失败,通过Range返回值error可以额捕获 // 参数为一个回调函数 // 返回值:bool,是否继续遍历 // 返回值:error,回调函数处理结果,error不为nil,则停止遍历过程,并且通过Range返回error Range(handler func(host string, location *model.Location) (bool, error)) error // Size 获取当前CMDB存储的entry个数 Size() int32 }
CMDB CMDB插件接口
type CheckRequest ¶
type CheckRequest struct { QueryRequest ExpireDurationSec uint32 CurTimeSec func() int64 }
CheckRequest check heartbeat request
type CheckResponse ¶
type CheckResponse struct { Healthy bool LastHeartbeatTimeSec int64 StayUnchanged bool Regular bool }
CheckResponse check heartbeat response
type Config ¶
type Config struct { CMDB ConfigEntry `yaml:"cmdb"` RateLimit ConfigEntry `yaml:"ratelimit"` History ConfigEntry `yaml:"history"` Statis ConfigEntry `yaml:"statis"` DiscoverStatis ConfigEntry `yaml:"discoverStatis"` ParsePassword ConfigEntry `yaml:"parsePassword"` Whitelist ConfigEntry `yaml:"whitelist"` MeshResourceValidate ConfigEntry `yaml:"meshResourceValidate"` DiscoverEvent ConfigEntry `yaml:"discoverEvent"` }
Config 插件配置
type ConfigEntry ¶
ConfigEntry 单个插件配置
type DiscoverChannel ¶
type DiscoverChannel interface { Plugin // PublishEvent 发布一个服务事件 PublishEvent(event model.InstanceEvent) }
DiscoverChannel is used to receive discover events from the agent
type DiscoverStatis ¶
type DiscoverStatis interface { Plugin // AddDiscoverCall 添加发现调用 AddDiscoverCall(service, namespace string, tt time.Time) error }
DiscoverStatis 服务发现统计插件接口
type HealthCheckType ¶
type HealthCheckType int32
HealthCheckType health check type
const (
HealthCheckerHeartbeat HealthCheckType = iota + 1
)
type HealthChecker ¶
type HealthChecker interface { Plugin // Type for health check plugin, only one same type plugin is allowed Type() HealthCheckType // Report process heartbeat info report Report(request *ReportRequest) error // Check process the instance check Check(request *CheckRequest) (*CheckResponse, error) // Query queries the heartbeat time Query(request *QueryRequest) (*QueryResponse, error) // AddToCheck add the instances to check procedure AddToCheck(request *AddCheckRequest) error // RemoveFromCheck removes the instances from check procedure RemoveFromCheck(request *AddCheckRequest) error // Delete delete the id Delete(id string) error }
HealthChecker health checker plugin interface
func GetHealthChecker ¶
func GetHealthChecker(name string, cfg *ConfigEntry) HealthChecker
GetHealthChecker get the health checker by name
type ParsePassword ¶
ParsePassword 密码插件
type Plugin ¶
type Plugin interface { Name() string Initialize(c *ConfigEntry) error Destroy() error }
Plugin 通用插件接口
type QueryRequest ¶
QueryRequest query heartbeat request
type QueryResponse ¶
QueryResponse query heartbeat response
type Ratelimit ¶
type Ratelimit interface { Plugin // Allow 是否允许访问, true: 允许, false: 不允许 TODO // 参数rateType即限流类型,id为限流的key // 如果rateType为RatelimitIP则id为ip, rateType为RatelimitService则id为ip_namespace_service或ip_serviceId Allow(typ RatelimitType, key string) bool }
Ratelimit Ratelimit插件接口
type RatelimitType ¶
type RatelimitType int
RatelimitType rate limit type
const ( // IPRatelimit 基于ip的流控 IPRatelimit RatelimitType = iota + 1 // APIRatelimit 基于接口级限流 APIRatelimit // ServiceRatelimit 基于service的流控 ServiceRatelimit // InstanceRatelimit 基于Instance的限流 InstanceRatelimit )
type ReportRequest ¶
type ReportRequest struct { QueryRequest LocalHost string CurTimeSec int64 }
ReportRequest report heartbeat request
Source Files ¶
Click to show internal directories.
Click to hide internal directories.