Exemple #1
0
void DbService::dbInit()
{
    leveldb::WriteOptions options;
    leveldb::WriteBatch batch;

    if (1) {
        // key: order+
        // key: order=
        BfOrderData bfNullOrder;
        std::string key = "order+";
        std::string val = bfNullOrder.SerializeAsString();
        batch.Put(key, val);
        key = "order=";
        val = bfNullOrder.SerializeAsString();
        batch.Put(key, val);
    }

    if (1) {
        // key: trade+
        // key: trade=
        BfTradeData bfNullTrade;
        std::string key = "trade+";
        std::string val = bfNullTrade.SerializeAsString();
        batch.Put(key, val);
        key = "trade=";
        val = bfNullTrade.SerializeAsString();
        batch.Put(key, val);
    }

    db_->Write(options, &batch);
}
Exemple #2
0
void DbService::dbInit()
{
    leveldb::WriteOptions options;
    leveldb::WriteBatch batch;

    if (1) {
        // key: gateway+
        // key: gateway=
        BfGatewayData bfNullGateway;
        std::string key = "gateway+";
        std::string val = bfNullGateway.SerializeAsString();
        batch.Put(key, val);
        key = "gateway=";
        val = bfNullGateway.SerializeAsString();
        batch.Put(key, val);
    }

    if (1) {
        // key: model+
        // key: model=
        BfModelData bfNullModel;
        std::string key = "model+";
        std::string val = bfNullModel.SerializeAsString();
        batch.Put(key, val);
        key = "model=";
        val = bfNullModel.SerializeAsString();
        batch.Put(key, val);
    }

    if (1) {
        // key: robot+
        // key: robot=
        BfRobotData bfNullRobot;
        std::string key = "robot+";
        std::string val = bfNullRobot.SerializeAsString();
        batch.Put(key, val);
        key = "robot=";
        val = bfNullRobot.SerializeAsString();
        batch.Put(key, val);
    }

    if (1) {
        // key: order+
        // key: order=
        BfOrderData bfNullOrder;
        std::string key = "order+";
        std::string val = bfNullOrder.SerializeAsString();
        batch.Put(key, val);
        key = "order=";
        val = bfNullOrder.SerializeAsString();
        batch.Put(key, val);
    }

    if (1) {
        // key: trade+
        // key: trade=
        BfTradeData bfNullTrade;
        std::string key = "trade+";
        std::string val = bfNullTrade.SerializeAsString();
        batch.Put(key, val);
        key = "trade=";
        val = bfNullTrade.SerializeAsString();
        batch.Put(key, val);
    }

    if (1) {
        // key: orderex+
        // key: orderex=
        BfOrderExData bfNullOrderEx;
        std::string key = "orderex+";
        std::string val = bfNullOrderEx.SerializeAsString();
        batch.Put(key, val);
        key = "orderex=";
        val = bfNullOrderEx.SerializeAsString();
        batch.Put(key, val);
    }

    db_->Write(options, &batch);
}