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

refactor sesion data store module #314

Merged
merged 24 commits into from
May 25, 2023
Merged

Conversation

@dbl-x dbl-x changed the title Chengyi dev refactor sesion data store module Mar 27, 2023
@nocvalight nocvalight requested review from dzdx and nocvalight May 22, 2023 03:28
@nocvalight
Copy link
Member

本次pr修改的类文件比较多,其中session上的存储结构的修改也比较大,是否可以在issue补充一些修改后的存储结构的设计考量,对象关系图等。这样对cr人会比较友好。

@dbl-x
Copy link
Author

dbl-x commented May 22, 2023

image

基础存储接口和实现如上图,他们和具体业务无关:

  • StoreEngine:最基础的存储接口
  • SimpleMemoryStoreEngine:基于内存的StoreEngine实现
  • SlotStoreEngine:继承StoreEngine,可以按照SlotId进行聚合
  • SlotMemoryStoreEngine:基于内存的SlotStoreEngine实现

@dbl-x
Copy link
Author

dbl-x commented May 22, 2023

  • ClientStore:客户端存储器,是PublisherStore、SubscriberStore、WatcherStore的基类,定义公共的方法,组合storeEngine实现真正的数据存储
  • PublisherStore:Publisher存储相关接口
  • SubscriberStore:Subscriber存储相关接口
  • WatcherStore:Watcher存储相关接口

@Override
public Pair<Boolean, T> putIfAbsent(T storeData) {
String dataInfoId = storeData.getDataInfoId();
ClientsGroup<T> clientsGroup = groups.get(dataInfoId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以直接使用computeIfAbsent()?不用自己做两次 == null的判断。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

Copy link
Member

@nocvalight nocvalight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dbl-x dbl-x requested a review from nocvalight May 25, 2023 09:47
@nocvalight nocvalight merged commit ffea162 into sofastack:develop May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants