From a46b40642462a45c37973972c7772af269a2be93 Mon Sep 17 00:00:00 2001 From: "vito.he" <hxmhlt@163.com> Date: Fri, 7 Feb 2020 16:31:32 +0800 Subject: [PATCH] Add:add some comment --- registry/base_registry.go | 14 ++++++++++++++ registry/registry.go | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/registry/base_registry.go b/registry/base_registry.go index 33eba5e8e..1c3e959bc 100644 --- a/registry/base_registry.go +++ b/registry/base_registry.go @@ -56,6 +56,17 @@ func init() { localIP, _ = gxnet.GetLocalIP() } +/* + * -----------------------------------NOTICE--------------------------------------------- + * If there is no special case, you'd better inherit BaseRegistry and implement the + * FacadeBasedRegistry interface instead of directly implementing the Registry interface. + * -------------------------------------------------------------------------------------- + */ + +/* + * This interface is subclass of Registry, and it is designed for registry who want to inherit BaseRegistry. + * You have to implement the interface to inherit BaseRegistry. + */ type FacadeBasedRegistry interface { Registry CreatePath(string) error @@ -66,6 +77,9 @@ type FacadeBasedRegistry interface { InitListeners() } +/* + * BaseRegistry is a common logic abstract for registry. It implement Registry interface. + */ type BaseRegistry struct { context context.Context facadeBasedRegistry FacadeBasedRegistry diff --git a/registry/registry.go b/registry/registry.go index 863e781ac..d67386470 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -21,6 +21,12 @@ import ( "github.com/apache/dubbo-go/common" ) +/* + * -----------------------------------NOTICE--------------------------------------------- + * If there is no special case, you'd better inherit BaseRegistry and implement the + * FacadeBasedRegistry interface instead of directly implementing the Registry interface. + * -------------------------------------------------------------------------------------- + */ // Registry Extension - Registry type Registry interface { common.Node -- GitLab