-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct the relationships around services, clusters and instances #1107
Comments
Correct the relationships around services, clusters and instancesIssue DescriptionType: feature request Describe what feature you wantCorrect the relationship between services, clusters and instances (Correct the relationships between services and clusters, clusters and instances) Since the code changes involved in #1098 are too large, you can start by modifying the relationship between service, cluster, and instance. (Since it's a huge work to support #1098 , so we can start from correcting the relationships around services, clusters and instances) Describe what you expected to happenAccording to the official nacos setting, a service consists of multiple clusters. A cluster consists of multiple instances. The UML diagram should be: service ◇→ cluster ◇→ instance (all aggregate relationships) (The uml class diagram should be service ◇ → cluster ◇→ instance) In general, the class structure of an aggregate relationship should be as follows: Service{
List<Cluster> clusters;
}
Cluster{
Service service;
List<Instance> instances;
}
Instance{
Cluster cluster;
} Unless it is a DTO, the attributes in the service name and other services should not appear in the cluster and instance, but should be obtained through service.getName. The cluster name should not appear in the same instance. This can ensure the consistency of the service attribute (such as name), one modification, and take effect everywhere. |
[ISSUE #1107] Quick fixing for the cluster deserialization issue
Finished in PR#1554 |
Issue Description
Type: feature request
Describe what feature you want
修正service,cluster和instance之间的关系(Correct the relationships between services and clusters, clusters and instances)
鉴于 #1098 涉及的代码修改过于庞大,因此可以先从修正service,cluster和instance之间的关系开始着手。(Since it's a huge work to support #1098 , so we can start from correcting the relationships around services, clusters and instances)
Describe what you expected to happen
根据nacos官方设定,一个service由多个cluster组成,一个cluster由多个instance组成,其UML图应为:service ◇→ cluster ◇→ instance (均为聚合关系)(The uml class diagram should be service ◇→ cluster ◇→ instance)
一般,聚合关系的类结构应该如下:
除非是DTO,否则cluster和instance中不应该出现service name等service中的属性(冗余),而应通过service.getName获取。同理instance中也不应该出现cluster name。这样可以保证service属性(比如name)的一致性,一处修改,处处生效。
目前naming模块的 service, cluster 和 instance 分别继承自api模块的 service, cluster 和 instance,而api模块的这三个类从作用来看类似于DTO,所以导致naming模块的三个类无法避免的拥有了冗余属性。这一块以后应该要彻底解决掉,但现在作为一个改动最小的临时方案,可以通过覆盖父类的方法来暂时达到目的。
The text was updated successfully, but these errors were encountered: