metadata

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Overview

Package metadata collects and exposes information of all services for service discovery purpose.

Index

Constants

This section is empty.

Variables

View Source
var MetadataServiceV2_ServiceInfo = common.ServiceInfo{
	InterfaceName: "org.apache.dubbo.metadata.MetadataServiceV2",
	ServiceType:   (*MetadataServiceV2Handler)(nil),
	Methods: []common.MethodInfo{
		{
			Name: "GetMetadataInfo",
			Type: constant.CallUnary,
			ReqInitFunc: func() interface{} {
				return new(tripleapi.MetadataRequest)
			},
			MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
				req := args[0].(*tripleapi.MetadataRequest)
				res, err := handler.(MetadataServiceV2Handler).GetMetadataInfo(ctx, req)
				if err != nil {
					return nil, err
				}
				return triple_protocol.NewResponse(res), nil
			},
		},
		{
			Name: "getMetadataInfo",
			Type: constant.CallUnary,
			ReqInitFunc: func() interface{} {
				return new(tripleapi.MetadataRequest)
			},
			MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
				req := args[0].(*tripleapi.MetadataRequest)
				res, err := handler.(MetadataServiceV2Handler).GetMetadataInfo(ctx, req)
				if err != nil {
					return nil, err
				}
				return triple_protocol.NewResponse(res), nil
			},
		},
	},
}
View Source
var MetadataService_ServiceInfo = common.ServiceInfo{
	InterfaceName: "org.apache.dubbo.metadata.MetadataService",
	ServiceType:   (*MetadataServiceHandler)(nil),
	Methods: []common.MethodInfo{
		{
			Name: "getMetadataInfo",
			Type: constant.CallUnary,
			ReqInitFunc: func() interface{} {
				return new(string)
			},
			MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
				revision := args[0].(*string)
				res, err := handler.(MetadataServiceHandler).GetMetadataInfo(ctx, *revision)
				return res, err
			},
		},
	},
}

Functions

func AddService

func AddService(registryId string, url *common.URL)

func AddSubscribeURL

func AddSubscribeURL(registryId string, url *common.URL)

func GetMetadataFromMetadataReport

func GetMetadataFromMetadataReport(revision string, instance registry.ServiceInstance) (*info.MetadataInfo, error)

func GetMetadataFromRpc

func GetMetadataFromRpc(revision string, instance registry.ServiceInstance) (*info.MetadataInfo, error)

func GetMetadataInfo

func GetMetadataInfo(registryId string) *info.MetadataInfo

func GetMetadataReport

func GetMetadataReport() report.MetadataReport

func GetMetadataReportByRegistry

func GetMetadataReportByRegistry(registry string) report.MetadataReport

func GetMetadataReports

func GetMetadataReports() []report.MetadataReport

func GetMetadataType

func GetMetadataType() string

func InitRegistryMetadataReport

func InitRegistryMetadataReport(registries map[string]*global.RegistryConfig) error

Types

type DefaultMetadataService

type DefaultMetadataService struct {
	// contains filtered or unexported fields
}

DefaultMetadataService is store and query the metadata info in memory when each service registry

func (*DefaultMetadataService) GetExportedServiceURLs

func (mts *DefaultMetadataService) GetExportedServiceURLs() ([]*common.URL, error)

GetExportedServiceURLs get exported service urls

func (*DefaultMetadataService) GetExportedURLs

func (mts *DefaultMetadataService) GetExportedURLs(serviceInterface string, group string, version string, protocol string) ([]*common.URL, error)

GetExportedURLs get all exported urls

func (*DefaultMetadataService) GetMetadataInfo

func (mts *DefaultMetadataService) GetMetadataInfo(revision string) (*info.MetadataInfo, error)

GetMetadataInfo can get metadata in memory

func (*DefaultMetadataService) GetMetadataServiceURL

func (mts *DefaultMetadataService) GetMetadataServiceURL() (*common.URL, error)

GetMetadataServiceURL get url of MetadataService

func (*DefaultMetadataService) GetSubscribedURLs

func (mts *DefaultMetadataService) GetSubscribedURLs() ([]*common.URL, error)

func (*DefaultMetadataService) MethodMapper

func (mts *DefaultMetadataService) MethodMapper() map[string]string

MethodMapper only for rename exported function, for example: rename the function GetMetadataInfo to getMetadataInfo

func (*DefaultMetadataService) Version

func (mts *DefaultMetadataService) Version() (string, error)

Version will return the version of metadata service

type DelegateMetadataReport

type DelegateMetadataReport struct {
	// contains filtered or unexported fields
}

DelegateMetadataReport is a absolute delegate for DelegateMetadataReport

func (*DelegateMetadataReport) GetAppMetadata

func (d *DelegateMetadataReport) GetAppMetadata(application, revision string) (*info.MetadataInfo, error)

GetAppMetadata delegate get metadata info

func (*DelegateMetadataReport) GetServiceAppMapping

func (d *DelegateMetadataReport) GetServiceAppMapping(application string, group string, listener mapping.MappingListener) (*gxset.HashSet, error)

func (*DelegateMetadataReport) PublishAppMetadata

func (d *DelegateMetadataReport) PublishAppMetadata(application, revision string, meta *info.MetadataInfo) error

PublishAppMetadata delegate publish metadata info

func (*DelegateMetadataReport) RegisterServiceAppMapping

func (d *DelegateMetadataReport) RegisterServiceAppMapping(interfaceName, group string, application string) error

func (*DelegateMetadataReport) RemoveServiceAppMappingListener

func (d *DelegateMetadataReport) RemoveServiceAppMappingListener(interfaceName, group string) error

type MetadataService

type MetadataService interface {
	// GetExportedURLs will get the target exported url in metadata, the url should be unique
	GetExportedURLs(serviceInterface string, group string, version string, protocol string) ([]*common.URL, error)
	// GetExportedServiceURLs will return exported service urls
	GetExportedServiceURLs() ([]*common.URL, error)
	// GetSubscribedURLs will get the exported urls in metadata
	GetSubscribedURLs() ([]*common.URL, error)
	Version() (string, error)
	// GetMetadataInfo will return metadata info
	GetMetadataInfo(revision string) (*info.MetadataInfo, error)
	// GetMetadataServiceURL will return the url of metadata service
	GetMetadataServiceURL() (*common.URL, error)
}

MetadataService is used to define meta data related behaviors usually the implementation should be singleton

func GetMetadataService

func GetMetadataService() MetadataService

type MetadataServiceHandler

type MetadataServiceHandler interface {
	GetMetadataInfo(ctx context.Context, revision string) (*info.MetadataInfo, error)
}

type MetadataServiceV1

type MetadataServiceV1 struct {
	// contains filtered or unexported fields
}

func (*MetadataServiceV1) GetMetadataInfo

func (mtsV1 *MetadataServiceV1) GetMetadataInfo(ctx context.Context, revision string) (*info.MetadataInfo, error)

type MetadataServiceV2

type MetadataServiceV2 struct {
	// contains filtered or unexported fields
}

func (*MetadataServiceV2) GetMetadataInfo

type MetadataServiceV2Handler

type MetadataServiceV2Handler interface {
	GetMetadataInfo(context.Context, *tripleapi.MetadataRequest) (*tripleapi.MetadataInfoV2, error)
}

MetadataServiceV2Handler is an implementation of the org.apache.dubbo.metadata.MetadataServiceV2 service.

type Option

type Option func(*Options)

func WithAppName

func WithAppName(app string) Option

func WithMetadataProtocol

func WithMetadataProtocol(protocol string) Option

func WithMetadataType

func WithMetadataType(typ string) Option

func WithPort

func WithPort(port int) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

func NewOptions

func NewOptions(opts ...Option) *Options

func (*Options) Init

func (opts *Options) Init() error

type ReportOption

type ReportOption func(*ReportOptions)

func WithAddress

func WithAddress(address string) ReportOption

WithAddress address metadata report will to use, if a URL schema is set,this will also set the protocol, such as WithAddress("zookeeper://127.0.0.1") will set address to "127.0.0.1" and protocol to "zookeeper"

func WithEtcdV3

func WithEtcdV3() ReportOption

func WithGroup

func WithGroup(group string) ReportOption

func WithNacos

func WithNacos() ReportOption

func WithNamespace

func WithNamespace(namespace string) ReportOption

func WithParams

func WithParams(params map[string]string) ReportOption

func WithPassword

func WithPassword(password string) ReportOption

func WithProtocol

func WithProtocol(meta string) ReportOption

func WithRegistryId

func WithRegistryId(id string) ReportOption

func WithTimeout

func WithTimeout(timeout time.Duration) ReportOption

func WithUsername

func WithUsername(username string) ReportOption

func WithZookeeper

func WithZookeeper() ReportOption

type ReportOptions

type ReportOptions struct {
	*global.MetadataReportConfig
	// contains filtered or unexported fields
}

func NewReportOptions

func NewReportOptions(opts ...ReportOption) *ReportOptions

func (*ReportOptions) Init

func (opts *ReportOptions) Init() error

Directories

Path Synopsis
triple_api

Jump to

Keyboard shortcuts

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