/*
 * Copyright 2021 Tianmian Tech. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.welab.wefe.data.fusion.service.repo;


import java.util.List;
import java.util.Map;

/**
 * @author hunter.zhao
 */
public abstract class Storage {

    // ==================== Local storage AbstractStorage should implement the method start ==========================

    /**
     * createTable
     * @param dbName
     * @param tbName
     * @param rows
     * @throws Exception
     */
    public abstract void createTable(String dbName, String tbName, List<String> rows) throws Exception;

    /**
     * dropTable
     * @param dbName
     * @param tbName
     * @throws Exception
     */
    public abstract void dropTable(String dbName, String tbName) throws Exception;


    /**
     * Insert data
     * @param dbName
     * @param tbName
     * @param x
     * @throws Exception
     */
    public abstract void insert(String dbName, String tbName, Map<String, Object> x) throws Exception;

    /**
     * Insert all data
     * @param dbName
     * @param tbName
     * @param rows
     * @throws Exception
     */
    public abstract void putAll(String dbName, String tbName, List<Map<String, Object>> rows) throws Exception;

    /**
     * Statistical data
     * @param dbName
     * @param tbName
     * @return
     * @throws Exception
     */
    public abstract int count(String dbName, String tbName) throws Exception;

}
