use of io.dingodb.server.coordinator.resource.impl.ExecutorView in project dingo by dingodb.
the class TableMetaAdaptorImpl method rangeLocationGroup.
@Override
public NavigableMap<byte[], LocationGroup> rangeLocationGroup() {
NavigableMap<byte[], LocationGroup> result = new TreeMap<>(BytesUtil.getDefaultByteArrayComparator());
Map<GeneralId, AppView<?, ?>> map = this.scheduleMetaAdaptor.namespaceView().appViews();
for (Map.Entry<GeneralId, AppView<?, ?>> entry : map.entrySet()) {
if (entry.getValue() instanceof RegionView) {
RegionView view = (RegionView) entry.getValue();
ExecutorView executorView = this.scheduleMetaAdaptor.executorView(view.leader());
Endpoint endpoint = executorView.stats().getLocation();
Location location = new Location(endpoint.getIp(), endpoint.getPort(), DATA_DIR);
List<Location> locationList = view.nodeResources().stream().map(id -> this.scheduleMetaAdaptor.namespaceView().<ExecutorView>getResourceView(id)).map(ExecutorView::location).collect(Collectors.toList());
LocationGroup locationGroup = new LocationGroup(location, locationList);
RegionApp regionApp = this.scheduleMetaAdaptor.regionApp(view.app());
result.put(BytesUtil.nullToEmpty(regionApp.startKey()), locationGroup);
}
}
return result;
}
Aggregations