package com.alibaba.csp.sentinel.dashboard.rule.nacos.processor;


import java.util.List;

/**
 * @author Clay
 * @date 2022/11/14
 */
public interface NacosPostProcessor {


    /**
     * 初始化
     *
     * @param app
     * @param ip
     * @param port
     * @throws Exception
     */
    void initPostProcessor(String app, String ip, Integer port) throws Exception;

    /**
     * 集群初始化
     *
     * @param app
     * @param ip
     * @param port
     * @throws Exception
     */
    void initClusterProcessor(String app, String ip, Integer port) throws Exception;

    /**
     * 发布路由规则
     *
     * @param app
     * @param ip
     * @param port
     * @param clazz
     * @return
     * @throws Exception
     */
    boolean publishRules(String app, String ip, Integer port, Class<?> clazz) throws Exception;

    /**
     * 发布集群情况下的路由规则
     *
     * @param app
     * @param ip
     * @param port
     * @param clazz
     * @return
     * @throws Exception
     */
    boolean publishClusterRules(String app, String ip, Integer port, Class<?> clazz) throws Exception;

    /**
     * 获取路由规则
     *
     * @param app
     * @param ip
     * @param port
     * @param clazz
     * @param <T>
     * @return
     */
    <T> List<T> getRules(String app, String ip, Integer port, Class<?> clazz) throws Exception;

    /**
     * 获取集群的路由规则
     *
     * @param app
     * @param ip
     * @param port
     * @param clazz
     * @param <T>
     * @return
     */
    <T> List<T> getClusterRules(String app, String ip, Integer port, Class<?> clazz) throws Exception;


}
