package com.jay.monitor.data.server.store;

import com.jay.monitor.data.server.enums.DataSplitType;
import com.jay.monitor.data.server.enums.StoreType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Module 处理器
 * @Description 数据分割处理器
 * @Author liukaixiong
 * @Date 2020/11/5 15:40
 */
public abstract class AbstractSplitDataProcess {

    private Logger logger = LoggerFactory.getLogger(getClass());

    public abstract void splitDataInvoke(DataSplitType splitData);

    /**
     * 存储类型
     *
     * @return
     */
    public abstract StoreType storeType();

    public void invoke(DataSplitType splitData) {
        try {
            splitDataInvoke(splitData);
        } catch (Exception e) {
            logger.error("AbstractSplitDataProcess.invoke : " + e.getMessage());
        }
    }

    public abstract String getDataId(String tableName, DataSplitType dataSplitType);

}
