feature(web): 增加 hdfs 路径补全
This commit is contained in:
@@ -8,6 +8,8 @@ import com.eshore.odcp.hudi.connector.entity.SyncState;
|
||||
import com.eshore.odcp.hudi.connector.entity.TableMeta;
|
||||
import com.eshore.odcp.hudi.connector.utils.NameHelper;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import com.lanyuanxiaoyao.service.configuration.ExecutorProvider;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.PageResponse;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.info.CompactionMetrics;
|
||||
@@ -22,7 +24,9 @@ import com.lanyuanxiaoyao.service.web.entity.CompactionMetricsVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.FlinkJobVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.SyncStateVO;
|
||||
import com.lanyuanxiaoyao.service.web.entity.TableVO;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
@@ -55,6 +59,20 @@ public class TableController extends BaseController {
|
||||
this.infoService = infoService;
|
||||
this.zookeeperService = zookeeperService;
|
||||
this.mapper = jackson2ObjectMapperBuilder.build();
|
||||
this.cache = Caffeine.newBuilder()
|
||||
.expireAfterAccess(Duration.ofMinutes(5))
|
||||
.build(key -> {
|
||||
switch (key) {
|
||||
case "flink_job_id":
|
||||
return this.infoService.allFlinkJobId().collect(Objects::toString);
|
||||
case "alias":
|
||||
return this.infoService.allAlias();
|
||||
case "hdfs":
|
||||
return this.infoService.allHdfs();
|
||||
default:
|
||||
return Lists.immutable.empty();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@@ -185,4 +203,33 @@ public class TableController extends BaseController {
|
||||
ImmutableList<CompactionMetricsVO> vos = Lists.immutable.ofAll(pageResponse.getData()).collect(CompactionMetricsVO::new);
|
||||
return AmisResponse.responseCrudData(vos, pageResponse.getTotal());
|
||||
}
|
||||
|
||||
private final LoadingCache<String, ImmutableList<String>> cache;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@GetMapping("all_flink_job_id")
|
||||
public AmisCrudResponse allFlinkJobId(@RequestParam(value = "key", required = false) String key) {
|
||||
if (StrUtil.isBlank(key)) {
|
||||
return AmisResponse.responseCrudData(Lists.immutable.empty());
|
||||
}
|
||||
return AmisResponse.responseCrudData(cache.get("flink_job_id").select(id -> StrUtil.contains(id, key)));
|
||||
}
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@GetMapping("all_alias")
|
||||
public AmisCrudResponse allAlias(@RequestParam(value = "key", required = false) String key) {
|
||||
if (StrUtil.isBlank(key)) {
|
||||
return AmisResponse.responseCrudData(Lists.immutable.empty());
|
||||
}
|
||||
return AmisResponse.responseCrudData(cache.get("alias").select(id -> StrUtil.contains(id, key)));
|
||||
}
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@GetMapping("all_hdfs")
|
||||
public AmisCrudResponse allHdfs(@RequestParam(value = "key", required = false) String key) {
|
||||
if (StrUtil.isBlank(key)) {
|
||||
return AmisResponse.responseCrudData(Lists.immutable.empty());
|
||||
}
|
||||
return AmisResponse.responseCrudData(cache.get("hdfs").select(id -> StrUtil.contains(id, key)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user