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 com.lanyuanxiaoyao.service.common.entity.RunMeta;
import com.lanyuanxiaoyao.service.configuration.entity.zookeeper.ZookeeperNode;
import org.eclipse.collections.api.list.ImmutableList;

/**
 * Zookeeper 查询
 *
 * @author lanyuanxiaoyao
 * @date 2023-05-13
 */
@BaseRequest(baseURL = "http://service-zookeeper-query/zookeeper")
public interface ZookeeperService {
    @Get("/exists_path")
    Boolean existsPath(@Query("path") String path);

    @Get("/exists_lock")
    Boolean existsLock(@Query("path") String path);

    @Get("/get_data")
    String getData(@Query("path") String path);

    @Get("/get_children")
    ImmutableList<ZookeeperNode> getChildren(@Query("path") String path);

    @Get("/get_sync_meta_by_flink_job_id")
    RunMeta getSyncRunMeta(@Query("flink_job_id") Long flinkJobId);

    @Get("/get_sync_meta_by_flink_job_id_and_alias")
    RunMeta getSyncRunMeta(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias);

    @Get("/get_compaction_meta_by_flink_job_id_and_alias")
    RunMeta getCompactionRunMeta(@Query("flink_job_id") Long flinkJobId, @Query("alias") String alias);

    @Get("/get_run_meta")
    RunMeta getRunMeta();
}
