Documentation ¶
Index ¶
- func CompressIfNecessary(data []byte) []byte
- func NoopSelectInstances(ctx *FilterContext, result *nacosmodel.ServiceInfo, ...) *nacosmodel.ServiceInfo
- func SelectInstancesWithHealthyProtection(ctx *FilterContext, result *nacosmodel.ServiceInfo, ...) *nacosmodel.ServiceInfo
- func ToNacosService(cacheMgr *cache.CacheManager, namespace, service, group string) *nacosmodel.ServiceMetadata
- func WarpGRPCPushData(p *PushData)
- func WarpUDPPushData(p *PushData)
- type BasePushCenter
- func (pc *BasePushCenter) AddSubscriber(s Subscriber, notifier Notifier) bool
- func (pc *BasePushCenter) GetSubscriber(s Subscriber) *WatchClient
- func (pc *BasePushCenter) NotifyClients(key nacosmodel.ServiceKey, notify func(client *WatchClient))
- func (pc *BasePushCenter) OnEvent(ctx context.Context, any2 any) error
- func (pc *BasePushCenter) PreProcess(_ context.Context, any any) any
- func (pc *BasePushCenter) RemoveClientIf(test func(string, *WatchClient) bool)
- func (pc *BasePushCenter) RemoveSubscriber(s Subscriber)
- type FilterContext
- type InstanceFilter
- type NacosDataStorage
- type Notifier
- type PushCenter
- type PushData
- type PushType
- type ServiceData
- type Subscriber
- type WatchClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompressIfNecessary ¶
func NoopSelectInstances ¶
func NoopSelectInstances(ctx *FilterContext, result *nacosmodel.ServiceInfo, instances []*nacosmodel.Instance, healthCount int32) *nacosmodel.ServiceInfo
func SelectInstancesWithHealthyProtection ¶
func SelectInstancesWithHealthyProtection(ctx *FilterContext, result *nacosmodel.ServiceInfo, instances []*nacosmodel.Instance, healthCount int32) *nacosmodel.ServiceInfo
func ToNacosService ¶
func ToNacosService(cacheMgr *cache.CacheManager, namespace, service, group string) *nacosmodel.ServiceMetadata
func WarpGRPCPushData ¶
func WarpGRPCPushData(p *PushData)
func WarpUDPPushData ¶
func WarpUDPPushData(p *PushData)
Types ¶
type BasePushCenter ¶
type BasePushCenter struct {
// contains filtered or unexported fields
}
func NewBasePushCenter ¶
func NewBasePushCenter(store *NacosDataStorage) (*BasePushCenter, error)
func (*BasePushCenter) AddSubscriber ¶
func (pc *BasePushCenter) AddSubscriber(s Subscriber, notifier Notifier) bool
func (*BasePushCenter) GetSubscriber ¶
func (pc *BasePushCenter) GetSubscriber(s Subscriber) *WatchClient
func (*BasePushCenter) NotifyClients ¶
func (pc *BasePushCenter) NotifyClients(key nacosmodel.ServiceKey, notify func(client *WatchClient))
func (*BasePushCenter) OnEvent ¶
func (pc *BasePushCenter) OnEvent(ctx context.Context, any2 any) error
OnEvent event process logic
func (*BasePushCenter) PreProcess ¶
func (pc *BasePushCenter) PreProcess(_ context.Context, any any) any
PreProcess do preprocess logic for event
func (*BasePushCenter) RemoveClientIf ¶
func (pc *BasePushCenter) RemoveClientIf(test func(string, *WatchClient) bool)
RemoveClientIf .
func (*BasePushCenter) RemoveSubscriber ¶
func (pc *BasePushCenter) RemoveSubscriber(s Subscriber)
type FilterContext ¶
type FilterContext struct { Service *nacosmodel.ServiceMetadata Clusters []string EnableOnly bool HealthyOnly bool SubscriberIP string }
FilterContext nacos 实例列表过滤上下文
type InstanceFilter ¶
type InstanceFilter func(ctx *FilterContext, svcInfo *nacosmodel.ServiceInfo, ins []*nacosmodel.Instance, healthyCount int32) *nacosmodel.ServiceInfo
InstanceFilter 实例过滤器
type NacosDataStorage ¶
type NacosDataStorage struct {
// contains filtered or unexported fields
}
NacosDataStorage .
func NewNacosDataStorage ¶
func NewNacosDataStorage(cacheMgr *cache.CacheManager) *NacosDataStorage
func (*NacosDataStorage) Cache ¶
func (n *NacosDataStorage) Cache() *cache.CacheManager
func (*NacosDataStorage) ListInstances ¶
func (n *NacosDataStorage) ListInstances(filterCtx *FilterContext, filter InstanceFilter) *nacosmodel.ServiceInfo
ListInstances list nacos instances by filter
func (*NacosDataStorage) RunSync ¶
func (n *NacosDataStorage) RunSync(ctx context.Context)
RunSync .
type PushCenter ¶
type PushCenter interface { // AddSubscriber AddSubscriber(s Subscriber) // RemoveSubscriber RemoveSubscriber(s Subscriber) // EnablePush EnablePush(s Subscriber) bool // Type Type() PushType }
PushCenter
type PushData ¶
type PushData struct { Service *nacosmodel.ServiceMetadata ServiceInfo *nacosmodel.ServiceInfo UDPData interface{} CompressUDPData []byte GRPCData interface{} CompressGRPCData []byte }
type ServiceData ¶
type ServiceData struct {
// contains filtered or unexported fields
}
ServiceData nacos 的服务数据模型
type Subscriber ¶
type Subscriber struct { Key string AddrStr string Agent string App string Ip string Port int NamespaceId string Group string Service string Cluster string Type PushType }
func (Subscriber) ResourceInfo ¶
func (s Subscriber) ResourceInfo() string
type WatchClient ¶
type WatchClient struct {
// contains filtered or unexported fields
}
func (*WatchClient) GetSubscribers ¶
func (w *WatchClient) GetSubscribers() []Subscriber
func (*WatchClient) ID ¶
func (w *WatchClient) ID() string
func (*WatchClient) IsZombie ¶
func (w *WatchClient) IsZombie() bool
func (*WatchClient) Notify ¶
func (w *WatchClient) Notify(d *PushData) error
func (*WatchClient) RefreshLastTime ¶
func (w *WatchClient) RefreshLastTime()
Click to show internal directories.
Click to hide internal directories.