add shutdown and fix deleted tuple handling in sherpa binding
git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@2663 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
parent
2756b886fe
commit
37795199fe
2 changed files with 15 additions and 2 deletions
|
@ -131,6 +131,13 @@ ping()
|
|||
return sherpa::ResponseCode::Ok;
|
||||
}
|
||||
|
||||
ResponseCode::type LSMServerHandler::
|
||||
shutdown()
|
||||
{
|
||||
exit(0); // xxx hack
|
||||
return sherpa::ResponseCode::Ok;
|
||||
}
|
||||
|
||||
ResponseCode::type LSMServerHandler::
|
||||
insert(datatuple* tuple)
|
||||
{
|
||||
|
@ -299,14 +306,19 @@ insert(const std::string& databaseName,
|
|||
const std::string& recordName,
|
||||
const std::string& recordBody)
|
||||
{
|
||||
// std::cerr << "inserting " << databaseName << "." << recordName << std::endl;
|
||||
uint32_t id = getDatabaseId(databaseName);
|
||||
if (id == 0) {
|
||||
return sherpa::ResponseCode::DatabaseNotFound;
|
||||
}
|
||||
datatuple* oldRecordBody = get(id, recordName);
|
||||
if (oldRecordBody != NULL) {
|
||||
datatuple::freetuple(oldRecordBody);
|
||||
return sherpa::ResponseCode::RecordExists;
|
||||
if(oldRecordBody->isDelete()) {
|
||||
datatuple::freetuple(oldRecordBody);
|
||||
} else {
|
||||
datatuple::freetuple(oldRecordBody);
|
||||
return sherpa::ResponseCode::RecordExists;
|
||||
}
|
||||
}
|
||||
|
||||
datatuple* tup = buildTuple(id, recordName, recordBody);
|
||||
|
|
|
@ -14,6 +14,7 @@ class LSMServerHandler : virtual public PersistentStoreIf {
|
|||
public:
|
||||
LSMServerHandler(int argc, char **argv);
|
||||
ResponseCode::type ping();
|
||||
ResponseCode::type shutdown();
|
||||
ResponseCode::type addDatabase(const std::string& databaseName);
|
||||
ResponseCode::type dropDatabase(const std::string& databaseName);
|
||||
void listDatabases(StringListResponse& _return);
|
||||
|
|
Loading…
Reference in a new issue