|
@ -233,6 +233,7 @@ int main( |
|
|
reply_size = sizeof(reply.rep_id) + sizeof(reply.identifier); |
|
|
reply_size = sizeof(reply.rep_id) + sizeof(reply.identifier); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
// case db_op::sremove:
|
|
|
case db_op::remove: |
|
|
case db_op::remove: |
|
|
{ |
|
|
{ |
|
|
reply.rep_id = recv.rep_id; |
|
|
reply.rep_id = recv.rep_id; |
|
@ -264,6 +265,48 @@ int main( |
|
|
reply_size = sizeof(reply); |
|
|
reply_size = sizeof(reply); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
case db_op::sallocate: |
|
|
|
|
|
{ |
|
|
|
|
|
reply.rep_id = recv.rep_id; |
|
|
|
|
|
reply.identifier = run_db.try_allocate(recv.identifier); |
|
|
|
|
|
reply_size = sizeof(reply.rep_id) + sizeof(reply.identifier); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case db_op::sread: |
|
|
|
|
|
{ |
|
|
|
|
|
reply.rep_id = recv.rep_id; |
|
|
|
|
|
auto req = run_db.stepped_read(recv.identifier); |
|
|
|
|
|
if(req.first.timestamp != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
reply.identifier = req.first; |
|
|
|
|
|
reply.page = req.second; |
|
|
|
|
|
reply_size = sizeof(reply); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
reply_size = sizeof(reply.rep_id) + sizeof(reply.identifier); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case db_op::swrite: |
|
|
|
|
|
{ |
|
|
|
|
|
reply.rep_id = recv.rep_id; |
|
|
|
|
|
try{ |
|
|
|
|
|
auto req = run_db.stepped_write(recv.identifier, recv.page); |
|
|
|
|
|
reply.identifier = req; |
|
|
|
|
|
} catch (...) { |
|
|
|
|
|
std::cerr << "cluster overfull"<< std::endl; |
|
|
|
|
|
} |
|
|
|
|
|
reply_size = sizeof(reply.rep_id) + sizeof(reply.identifier); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
case db_op::confirm: |
|
|
|
|
|
{ |
|
|
|
|
|
reply.rep_id = recv.rep_id; |
|
|
|
|
|
run_db.confirm(recv.identifier, *(bitops::regulated<uint64_t>*)&recv.page); |
|
|
|
|
|
reply_size = sizeof(reply.rep_id); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
default: |
|
|
default: |
|
|
std::cerr << "bad_request " << (uint32_t)static_cast<db_op>(recv.op) << std::endl; |
|
|
std::cerr << "bad_request " << (uint32_t)static_cast<db_op>(recv.op) << std::endl; |
|
|
continue; |
|
|
continue; |
|
|