Skip to content
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

Session的store模块整体的命名不清晰,以及部分接口定义不合理 #308

Open
dbl-x opened this issue Mar 15, 2023 · 0 comments

Comments

@dbl-x
Copy link

dbl-x commented Mar 15, 2023

Your question

  1. store模块各个接口命名不清晰,无法表达清楚的含义(下面给出)
  2. 部分实现没有合理的接口抽象,比如SlotStore

Your scenes

1、命名问题

  • DataStore:实际用于存储Publisher信息,建议使用PublisherStore(当然,Store数据是可以读取的),DataStore容易误解为同样的数据存储,特别是它的实现类叫SessionDataStore,会误解为Session节点的数据存储
  • Interests:实际用于存储Subscriber信息,建议使用SubscriberStore
  • Watchers:实际用于存储Watcher信息,建议使用WatcherStore
  • Store、DataStore和DataManager:Store是内置的,较为底层的存储接口的设计,DataStore实际是继承DataManager的接口,让人分不清楚这几个接口的职责

2、部分接口或者实现不合理

  • SlotStore实际组合了SimpleStore,实现了按槽进行存储,可以增加一个SlotStore接口,提供读取特定槽位的数据等能力,而将当前的SlotStore修改为一个实现类(当前SlotStore通过一些public方法暴露了slot相关的操作)
  • 多个接口使用了集合类的嵌套,比如Map<String, Map<String, T>>、Map<DATAINFOID, Map<ID, DATA>>——这个还结合了泛型,使得代码的可读性变得比较差
  • 类似Tuple<Long, Long> count()这个接口,除非去读实现,否则无法理解返回的两个Long的含义
  • 实现不内聚,可以通过store#get拿到存储数据的Map,在外部去操作这个Map进行数据删除等操作

Your advice

对store整体做一个Review和重构,使命名和实现更加优雅

Environment

  • SOFARegistry version: 6.1.9
  • JVM version (e.g. java -version):
  • OS version (e.g. uname -a):
  • Maven version:
  • IDE version:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant