Exemple #1
0
void Store::run()
{
    if(!_isRunning)
    {
#if INCLUDE_DEFINER_STATEMENTS == 1
        if(!_extraDefinerLayer)
        {
            vector<shared_ptr<zmq::socket_t>> definerSinkVector;
            
            for(unsigned short threadNo = 0; threadNo < _noDefinerThread; threadNo++)
            {
                shared_ptr<zmq::socket_t> taskSenderSocket(new zmq::socket_t(*_serverTransport->getContext(), ZMQ_PUSH));
                taskSenderSocket->connect(TransportUtils::getSinkName(_DEFINER_SINK_NAME, threadNo).c_str());
                
                definerSinkVector.push_back(taskSenderSocket);
            }
            
            _taskSenderSockets.push_back(definerSinkVector);
            
            for(unsigned short threadNo = 0 ; threadNo < _noDefinerThread; threadNo++)
                _definerThreads.push_back(shared_ptr<thread>(new thread(&Store::_definerWorkerThreadFunc, this, threadNo)));

        }
        else
#endif
        {
            _taskSenderSockets = createExecutorTaskSenderSockets();
        }
        
        _serverTransport->start(_storePort);
        
        for(unsigned short threadNo = 0 ; threadNo < _noExecutorThreads; threadNo++)
            _executorThreads.push_back(shared_ptr<thread>(new thread(&Store::_executorWorkerThreadFunc, this, threadNo)));
        
        waitForExecutorsToInitialize();
        _initDB();
        
        _isRunning = true;
    }
}
 DatabaseBuilder::DatabaseBuilder(const std::string& dbPath) :
 _db(std::make_shared<AmigoCloud::Database>(dbPath, true)) {
     _initDB();
 }
 DatabaseBuilder::DatabaseBuilder(std::shared_ptr<AmigoCloud::Database> db) :
 _db(db) {
     _initDB();
 }