diff --git a/registry/base_registry.go b/registry/base_registry.go index 33eba5e8e1673283daa02fd096c1339eec26b997..1c3e959bc5ffa6c6691cade910bdd0f1d6bfaae3 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 863e781ac7bfa1c09561a6a4ab59c7f7a14e89d2..d673864700e6ba99e8f0283247d53760b85598aa 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