-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add list options for sync all synchronizer (#6145)
#### What type of PR is this? /kind improvement /area core /milestone 2.17.x #### What this PR does / why we need it: 为启动时同步添加 ListOptions 选项为后续保持 ExtensionMatcher 的纯粹做准备,后续将移除 ExtensionMatcher 中多余的方法声明,只保留 match 方法,最终的结果希望是 ```java @FunctionalInterface public interface ExtensionMatcher { boolean match(Extension extension); } ``` 以前构建 Controller 的写法 ```java public Controller setupWith(ControllerBuilder builder) { return builder .extension(new Post()) .onAddMatcher(DefaultExtensionMatcher.builder(client, Post.GVK) .fieldSelector(FieldSelector.of( equal(Post.REQUIRE_SYNC_ON_STARTUP_INDEX_NAME, TRUE)) ) .build() ) .build(); } ``` 现在的写法 ```java public Controller setupWith(ControllerBuilder builder) { var post = new Post(); return builder .extension(post) // 当有新数据添加时 .onAddMatcher(extension -> "fake-post".equals(extension.getMetadata().getName())) // 使用 syncAllListOptions 作为启动时同步的查询条件过滤不需要的数据 .syncAllListOptions(ListOptions.builder() .fieldQuery(equal(Post.REQUIRE_SYNC_ON_STARTUP_INDEX_NAME, TRUE)) .build() ) .build(); } ``` #### Does this PR introduce a user-facing change? ```release-note 开发者相关:重构 ControllerBuilder 的匹配条件并增加 syncAllListOptions 作为启动时同步的查询条件 ```
- Loading branch information
Showing
5 changed files
with
74 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters