From 96c8de9bc49e52f559e1d4b96a4df640c78a7fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E9=9B=84?= <38287096+xiongpan828@users.noreply.github.com> Date: Mon, 11 Jul 2022 19:40:35 +0800 Subject: [PATCH] style(contrib/registry/*) annotation perfect (#2185) Co-authored-by: xiongpan828@qq.com --- contrib/registry/eureka/client.go | 2 +- contrib/registry/eureka/register.go | 4 ++-- contrib/registry/kubernetes/registry.go | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/registry/eureka/client.go b/contrib/registry/eureka/client.go index 5895a0576..64cdddec9 100644 --- a/contrib/registry/eureka/client.go +++ b/contrib/registry/eureka/client.go @@ -37,7 +37,7 @@ type Endpoint struct { MetaData map[string]string } -// Response for /eureka/apps +// ApplicationsRootResponse for /eureka/apps type ApplicationsRootResponse struct { ApplicationsResponse `json:"applications"` } diff --git a/contrib/registry/eureka/register.go b/contrib/registry/eureka/register.go index 31727242b..62ee81cfc 100644 --- a/contrib/registry/eureka/register.go +++ b/contrib/registry/eureka/register.go @@ -59,7 +59,7 @@ func New(eurekaUrls []string, opts ...Option) (*Registry, error) { return r, nil } -// 这里的Context是每个注册器独享的 +// Register 这里的Context是每个注册器独享的 func (r *Registry) Register(ctx context.Context, service *registry.ServiceInstance) error { return r.api.Register(ctx, service.Name, r.Endpoints(service)...) } @@ -86,7 +86,7 @@ func (r *Registry) GetService(ctx context.Context, serviceName string) ([]*regis return items, nil } -// watch 是独立的ctx +// Watch 是独立的ctx func (r *Registry) Watch(ctx context.Context, serviceName string) (registry.Watcher, error) { return newWatch(ctx, r.api, serviceName) } diff --git a/contrib/registry/kubernetes/registry.go b/contrib/registry/kubernetes/registry.go index e8aaa169e..bd752bc13 100644 --- a/contrib/registry/kubernetes/registry.go +++ b/contrib/registry/kubernetes/registry.go @@ -1,4 +1,4 @@ -// The package registry simply implements the Kubernetes-based Registry +// Package kuberegistry registry simply implements the Kubernetes-based Registry package kuberegistry import ( @@ -78,7 +78,7 @@ const ( AnnotationsKeyProtocolMap = "kratos-service-protocols" ) -// The registry simply implements service discovery based on Kubernetes +// The Registry simply implements service discovery based on Kubernetes // It has not been verified in the production environment and is currently for reference only type Registry struct { clientSet *kubernetes.Clientset @@ -156,7 +156,7 @@ func (s *Registry) Deregister(ctx context.Context, service *registry.ServiceInst }) } -// Service return the service instances in memory according to the service name. +// GetService return the service instances in memory according to the service name. func (s *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error) { pods, err := s.podLister.List(labels.SelectorFromSet(map[string]string{ LabelsKeyServiceName: name, @@ -258,7 +258,7 @@ func GetNamespace() string { return currentNamespace } -// GetNamespace is used to get the name of the Pod where the current container is located +// GetPodName is used to get the name of the Pod where the current container is located func GetPodName() string { return os.Getenv("HOSTNAME") }