Documentation
¶
Overview ¶
Package metadata collects and exposes information of all services for service discovery purpose.
Index ¶
- Variables
- func AddService(registryId string, url *common.URL)
- func AddSubscribeURL(registryId string, url *common.URL)
- func GetMetadataFromMetadataReport(revision string, instance registry.ServiceInstance) (*info.MetadataInfo, error)
- func GetMetadataFromRpc(revision string, instance registry.ServiceInstance) (*info.MetadataInfo, error)
- func GetMetadataInfo(registryId string) *info.MetadataInfo
- func GetMetadataReport() report.MetadataReport
- func GetMetadataReportByRegistry(registry string) report.MetadataReport
- func GetMetadataReports() []report.MetadataReport
- func GetMetadataType() string
- func InitRegistryMetadataReport(registries map[string]*global.RegistryConfig) error
- type DefaultMetadataService
- func (mts *DefaultMetadataService) GetExportedServiceURLs() ([]*common.URL, error)
- func (mts *DefaultMetadataService) GetExportedURLs(serviceInterface string, group string, version string, protocol string) ([]*common.URL, error)
- func (mts *DefaultMetadataService) GetMetadataInfo(revision string) (*info.MetadataInfo, error)
- func (mts *DefaultMetadataService) GetMetadataServiceURL() (*common.URL, error)
- func (mts *DefaultMetadataService) GetSubscribedURLs() ([]*common.URL, error)
- func (mts *DefaultMetadataService) MethodMapper() map[string]string
- func (mts *DefaultMetadataService) Version() (string, error)
- type DelegateMetadataReport
- func (d *DelegateMetadataReport) GetAppMetadata(application, revision string) (*info.MetadataInfo, error)
- func (d *DelegateMetadataReport) GetServiceAppMapping(application string, group string, listener mapping.MappingListener) (*gxset.HashSet, error)
- func (d *DelegateMetadataReport) PublishAppMetadata(application, revision string, meta *info.MetadataInfo) error
- func (d *DelegateMetadataReport) RegisterServiceAppMapping(interfaceName, group string, application string) error
- func (d *DelegateMetadataReport) RemoveServiceAppMappingListener(interfaceName, group string) error
- type MetadataService
- type MetadataServiceHandler
- type MetadataServiceV1
- type MetadataServiceV2
- type MetadataServiceV2Handler
- type Option
- type Options
- type ReportOption
- func WithAddress(address string) ReportOption
- func WithEtcdV3() ReportOption
- func WithGroup(group string) ReportOption
- func WithNacos() ReportOption
- func WithNamespace(namespace string) ReportOption
- func WithParams(params map[string]string) ReportOption
- func WithPassword(password string) ReportOption
- func WithProtocol(meta string) ReportOption
- func WithRegistryId(id string) ReportOption
- func WithTimeout(timeout time.Duration) ReportOption
- func WithUsername(username string) ReportOption
- func WithZookeeper() ReportOption
- type ReportOptions
Constants ¶
This section is empty.
Variables ¶
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 }, }, }, }
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 AddSubscribeURL ¶
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 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 ¶
func (mtsV2 *MetadataServiceV2) GetMetadataInfo(ctx context.Context, req *tripleapi.MetadataRequest) (*tripleapi.MetadataInfoV2, error)
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 WithMetadataProtocol ¶
func WithMetadataType ¶
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