package com.lanyuanxiaoyao.service.forest.service;

import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Get;
import com.dtflys.forest.annotation.Query;
import org.eclipse.collections.api.list.ImmutableList;

/**
 * 任务服务
 *
 * @author lanyuanxiaoyao
 * @date 2024-01-10
 */
@BaseRequest(baseURL = "http://service-executor-manager")
public interface TaskService {
    @Get(value = "/task/scan", readTimeout = 2 * 60 * 1000)
    String scan(
            @Query("key") String key,
            @Query("hdfs") String hdfs,
            @Query("pulsar") String pulsar,
            @Query("pulsar_topic") String pulsarTopic,
            @Query("scan_queue") Boolean scanQueue,
            @Query("scan_log") Boolean scanLog,
            @Query("scan_base") Boolean scanBase
    );

    @Get(value = "/task/latest_op_ts", readTimeout = 2 * 60 * 1000)
    String latestOpTs(@Query("hdfs") String hdfs);

    @Get("/task/results")
    ImmutableList<String> results(@Query("task_id") String taskId);

    @Get("/task/results")
    ImmutableList<String> results(@Query("task_id") String taskId, @Query("limit") Integer limit);
}
