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)
- func WrirteNacosErrorResponse(data error, resp *restful.Response)
- func WrirteNacosResponse(data interface{}, resp *restful.Response)
- func WrirteNacosResponseWithCode(code int, data interface{}, resp *restful.Response)
- func WrirteSimpleResponse(data string, code int, resp *restful.Response)
- 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)
func WrirteNacosErrorResponse ¶
func WrirteNacosErrorResponse(data error, resp *restful.Response)
WrirteNacosErrorResponse .
func WrirteNacosResponse ¶
func WrirteNacosResponse(data interface{}, resp *restful.Response)
WrirteNacosResponse .
func WrirteNacosResponseWithCode ¶
func WrirteNacosResponseWithCode(code int, data interface{}, resp *restful.Response)
WrirteNacosResponseWithCode .
func WrirteSimpleResponse ¶
WrirteSimpleResponse .
Types ¶
type BasePushCenter ¶
type BasePushCenter struct {
// contains filtered or unexported fields
}
func NewBasePushCenter ¶
func NewBasePushCenter(store *NacosDataStorage) *BasePushCenter
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
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)
type PushCenter ¶
type PushCenter interface { AddSubscriber(s Subscriber) RemoveSubscriber(s Subscriber) EnablePush(s Subscriber) bool Type() PushType }
type PushData ¶
type PushData struct { Service *model.Service 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 WatchClient ¶
type WatchClient struct {
// contains filtered or unexported fields
}
func (*WatchClient) GetSubscriber ¶
func (w *WatchClient) GetSubscriber() Subscriber
func (*WatchClient) IsZombie ¶
func (w *WatchClient) IsZombie() bool
func (*WatchClient) RefreshLastTime ¶
func (w *WatchClient) RefreshLastTime()
Click to show internal directories.
Click to hide internal directories.