"use strict";
/*
 * Tencent is pleased to support the open source community by making
 * Hippy available.
 *
 * Copyright (C) 2017-2019 THL A29 Limited, a Tencent company.
 * 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.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDbModel = exports.getDBOperator = void 0;
const config_1 = require("@debug-server-next/config");
const memory_db_1 = require("./memory/memory-db");
const pub_sub_1 = require("./memory/pub-sub");
const redis_db_1 = require("./redis/redis-db");
const pub_sub_2 = require("./redis/pub-sub");
let DB;
let Publisher;
let Subscriber;
const getDBOperator = () => ({
    DB,
    Publisher,
    Subscriber,
});
exports.getDBOperator = getDBOperator;
const initDbModel = () => {
    if (config_1.config.isCluster) {
        DB = redis_db_1.RedisDB;
        Publisher = pub_sub_2.RedisPublisher;
        Subscriber = pub_sub_2.RedisSubscriber;
    }
    else {
        DB = memory_db_1.MemoryDB;
        Publisher = pub_sub_1.MemoryPubSub;
        Subscriber = pub_sub_1.MemoryPubSub;
    }
};
exports.initDbModel = initDbModel;
