stasis-bLSM/servers/mapkeeper/main/blsm_server.cpp
sears 3104ccaec1 add missing license headers
git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@3803 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
2012-02-28 21:11:51 +00:00

55 lines
2.1 KiB
C++

/*
* blsm_server.cpp
*
* Copyright 2009-2012 Yahoo! Inc.
*
* 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.
*
*/
#include "MapKeeper.h"
#include <protocol/TBinaryProtocol.h>
#include <server/TSimpleServer.h>
#include <server/TThreadPoolServer.h>
#include <server/TThreadedServer.h>
#include <transport/TServerSocket.h>
#include <transport/TBufferTransports.h>
#include <concurrency/ThreadManager.h>
#include <concurrency/PosixThreadFactory.h>
#include "bLSM.h"
#include "dataTuple.h"
#include "bLSMRequestHandler.h"
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using namespace ::apache::thrift::concurrency;
using boost::shared_ptr;
using namespace mapkeeper;
int main(int argc, char **argv) {
shared_ptr<LSMServerHandler> handler(new LSMServerHandler(argc, argv));
shared_ptr<TProcessor> processor(new MapKeeperProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(handler->port));
shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(32);
shared_ptr<ThreadFactory> threadFactory(new PosixThreadFactory());
//threadManager->threadFactory(threadFactory);
//threadManager->start();
TThreadedServer server(processor, serverTransport, transportFactory, protocolFactory);
printf("I'm using tthreaded server!");
server.serve();
return 0;
}