add --port option

git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@3566 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
sears 2012-01-13 00:13:33 +00:00
parent 1c4d3068f5
commit 6368f16bc0
3 changed files with 8 additions and 4 deletions

View file

@ -19,13 +19,13 @@ LSMServerHandler(int argc, char **argv)
// how big the in-memory tree should be (512MB). // how big the in-memory tree should be (512MB).
int64_t c0_size = 1024 * 1024 * 512 * 1; int64_t c0_size = 1024 * 1024 * 512 * 1;
// write-ahead log // write-ahead log
// 1 -> sync on each commit // 1 -> sync on each commit
// 2 -> sync on each 2 commits // 2 -> sync on each 2 commits
// ... // ...
int log_mode = 0; // do not log by default. int log_mode = 0; // do not log by default.
int64_t expiry_delta = 0; // do not gc by default int64_t expiry_delta = 0; // do not gc by default
port = 9090;
stasis_buffer_manager_size = 1 * 1024 * 1024 * 1024 / PAGE_SIZE; // 1.5GB total stasis_buffer_manager_size = 1 * 1024 * 1024 * 1024 / PAGE_SIZE; // 1.5GB total
@ -45,8 +45,11 @@ LSMServerHandler(int argc, char **argv)
} else if(!strcmp(argv[i], "--log-mode")) { } else if(!strcmp(argv[i], "--log-mode")) {
i++; i++;
log_mode = atoi(argv[i]); log_mode = atoi(argv[i]);
} else if(!strcmp(argv[i], "--blind-update")) { } else if(!strcmp(argv[i], "--port")) {
blind_update = 1; i++;
port = atoi(argv[i]);
} else if(!strcmp(argv[i], "--blind-update")) {
blind_update = 1;
} else if(!strcmp(argv[i], "--expiry-delta")) { } else if(!strcmp(argv[i], "--expiry-delta")) {
i++; i++;
expiry_delta = atoi(argv[i]); expiry_delta = atoi(argv[i]);

View file

@ -28,6 +28,7 @@ public:
ResponseCode::type insertMany(const std::string& databaseName, const std::vector<Record> & records); ResponseCode::type insertMany(const std::string& databaseName, const std::vector<Record> & records);
ResponseCode::type update(const std::string& databaseName, const std::string& recordName, const std::string& recordBody); ResponseCode::type update(const std::string& databaseName, const std::string& recordName, const std::string& recordBody);
ResponseCode::type remove(const std::string& databaseName, const std::string& recordName); ResponseCode::type remove(const std::string& databaseName, const std::string& recordName);
short port;
private: private:
ResponseCode::type insert(datatuple* tuple); ResponseCode::type insert(datatuple* tuple);

View file

@ -23,7 +23,7 @@ using namespace mapkeeper;
int main(int argc, char **argv) { int main(int argc, char **argv) {
shared_ptr<LSMServerHandler> handler(new LSMServerHandler(argc, argv)); shared_ptr<LSMServerHandler> handler(new LSMServerHandler(argc, argv));
shared_ptr<TProcessor> processor(new MapKeeperProcessor(handler)); shared_ptr<TProcessor> processor(new MapKeeperProcessor(handler));
shared_ptr<TServerTransport> serverTransport(new TServerSocket(9090)); shared_ptr<TServerTransport> serverTransport(new TServerSocket(handler->port));
shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory()); shared_ptr<TTransportFactory> transportFactory(new TFramedTransportFactory());
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory()); shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(32); shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(32);