core

package
v0.0.0-...-dce2b97 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 22 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)

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

func WrirteSimpleResponse(data string, code int, resp *restful.Response)

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 Notifier

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

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 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
	ConnID      string
	AddrStr     string
	Agent       string
	App         string
	Ip          string
	Port        int
	NamespaceId string
	Group       string
	Service     string
	Cluster     string
	Type        PushType
}

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

Jump to

Keyboard shortcuts

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