core

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressIfNecessary

func CompressIfNecessary(data []byte) []byte

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 Notifier

type Notifier interface {
	io.Closer
	Notify(d *PushData) error
	IsZombie() bool
}

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 PushType

type PushType string
const (
	NoopPush     PushType = "noop"
	UDPCPush     PushType = "udp"
	GRPCPush     PushType = "grpc"
	AssemblyPush PushType = "assembly"
)

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()

Jump to

Keyboard shortcuts

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