Skip to content

Commit

Permalink
fix review issue
Browse files Browse the repository at this point in the history
Signed-off-by: OneSizeFitQuorum <[email protected]>
  • Loading branch information
OneSizeFitsQuorum committed Jun 13, 2024
1 parent 5d5e3d9 commit 0793a93
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ private void getStorageGroupCacheResult(
boolean isAutoCreate,
String userName) {
if (!isAutoCreate) {
// TODO: avoid IDeviceID contains "*"
// miss when deviceId contains *
for (IDeviceID deviceID : devicePaths) {
for (int i = 0; i < deviceID.segmentNum(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

public class PathPatternTree {

Expand Down Expand Up @@ -174,10 +173,15 @@ public boolean isEmpty() {

public List<IDeviceID> getAllDevicePatterns() {
List<String> nodes = new ArrayList<>();
Set<String> results = new HashSet<>();
searchDevicePattern(root, nodes, results);
// TODO avoid unnecessary conversion
return results.stream().map(Factory.DEFAULT_FACTORY::create).collect(Collectors.toList());
Set<List<String>> resultNodesSet = new HashSet<>();
searchDevicePath(root, nodes, resultNodesSet);

Set<IDeviceID> resultPaths = new HashSet<>();
for (List<String> resultNodes : resultNodesSet) {
resultPaths.add(Factory.DEFAULT_FACTORY.create(resultNodes.toArray(new String[0])));
}

return new ArrayList<>(resultPaths);
}

public List<PartialPath> getAllDevicePaths() {
Expand Down

0 comments on commit 0793a93

Please sign in to comment.