Small bug fix

parent 1838e1d5
......@@ -11,6 +11,8 @@
#include <sstream>
#include <map>
#include <cstdio>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <grpc/support/log.h>
#include <grpcpp/grpcpp.h>
......@@ -89,17 +91,17 @@ public:
//Impliment here
//Start
result = get12(request_.key());
if(result=="4")
if (result == "4")
{
response_.set_status(400);
response_.set_val("key or value is empty");
}
else if (result=="2")
else if (result == "2")
{
response_.set_status(400);
response_.set_val("key not found");
}
else if(result=="3")
else if (result == "3")
{
response_.set_status(400);
response_.set_val("key or value string byte is more than 256 byte");
......@@ -109,7 +111,7 @@ public:
response_.set_status(200);
response_.set_val(result);
}
//End
responder_.Finish(response_, grpc::Status::OK, &proceed);
status_ = FINISH;
......@@ -186,17 +188,17 @@ public:
//Impliment here
//Start
result = delete1(request_.key());
if(result==1)
if (result == 1)
{
response_.set_status(200);
response_.set_err("Entry Deleted");
}
else if (result==2)
else if (result == 2)
{
response_.set_status(400);
response_.set_err("key not found");
}
else if(result==3)
else if (result == 3)
{
response_.set_status(400);
response_.set_err("key or value string byte is more than 256 byte");
......@@ -282,7 +284,7 @@ public:
new PutCall(data_);
//Impliment here
//Start
result = put(request_.key(),request_.val());
result = put(request_.key(), request_.val());
response_.set_status(200);
//End
responder_.Finish(response_, grpc::Status::OK, &proceed);
......@@ -456,16 +458,24 @@ void config()
int main(int argc, char **argv)
{
freopen("log.txt", "w", stderr);
int check = mkdir("data", 0777);
if (!check)
std::cerr << "Directory created\n";
else
{
std::cerr <<"Unable to create directory\n";
exit(1);
}
config();
run();
cache_block = cache_size / 512;
if(cache_type=="LFU")
if (cache_type == "LFU")
{
config_cache(1,cache_block);
config_cache(1, cache_block);
}
else
{
config_cache(2,cache_block);
config_cache(2, cache_block);
}
ServerImpl server;
server.Run();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment