Skip to content

Commit

Permalink
Fixed PRF error
Browse files Browse the repository at this point in the history
  • Loading branch information
sharathvemula committed Feb 20, 2023
1 parent e83b362 commit a19d178
Show file tree
Hide file tree
Showing 20 changed files with 42,569 additions and 5 deletions.
Binary file modified waffleClient/bin/proxy_benchmark
Binary file not shown.
Binary file modified waffleClient/bin/proxy_server
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Empty file.
2,905 changes: 2,905 additions & 0 deletions waffleClient/data/BST_Latency_MonFeb2014:16/1

Large diffs are not rendered by default.

17,537 changes: 17,537 additions & 0 deletions waffleClient/data/BST_Latency_MonFeb2014:18/1

Large diffs are not rendered by default.

1,876 changes: 1,876 additions & 0 deletions waffleClient/data/MonFeb2014:18/1

Large diffs are not rendered by default.

Empty file.
Empty file.
Empty file.
Empty file.
2,734 changes: 2,734 additions & 0 deletions waffleClient/data/Redis_Latency_MonFeb2014:16/1

Large diffs are not rendered by default.

17,503 changes: 17,503 additions & 0 deletions waffleClient/data/Redis_Latency_MonFeb2014:18/1

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions waffleClient/proxy/src/waffle_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void waffle_proxy::init(const std::vector<std::string> &keys, const std::vector<

//Adding the data to Database
std::cout << "Keys size in init() is " << keys.size() << std::endl;
std::unordered_map<std::string, std::string> keyValueMap;
// std::unordered_map<std::string, std::string> keyValueMap;
// std::cout << "0th key is " << keys[0] << std::endl;
for(int i = 0; i<keys.size(); ++i) {
realBst.insert(keys[i]);
Expand All @@ -126,7 +126,7 @@ void waffle_proxy::init(const std::vector<std::string> &keys, const std::vector<
// std::cout << "First querying key is not available " << std::endl;
// }

std::cout << "Init encryption string is " << encryption_engine_.getencryption_string_() << std::endl;
// std::cout << "Init encryption string is " << encryption_engine_.getencryption_string_() << std::endl;
// Initialising Cache
size_t cacheCapacity = R+s;
std::unordered_set<std::string> temp;
Expand Down Expand Up @@ -265,8 +265,9 @@ void waffle_proxy::execute_batch(const std::vector<operation> &operations, std::
rdtscllProxy(start);
}

std::cout << "execute_batch encryption string is " << enc_engine->getencryption_string_() << std::endl;
// std::cout << "execute_batch encryption string is " << enc_engine->getencryption_string_() << std::endl;

// std::cout << "r is " << operations.size() << std::endl;
for(int i = 0; i < operations.size(); i++){
std::string key = operations[i].key;
auto stKey = enc_engine->prf(key + "#" + std::to_string(realBst.getFrequency(key)));
Expand All @@ -288,12 +289,14 @@ void waffle_proxy::execute_batch(const std::vector<operation> &operations, std::
// std::cout << "realKeysNotInCache size is " << realKeysNotInCache.size() << std::endl;

for(auto& iter: realKeysNotInCache) {
auto stKey = enc_engine->encrypt(iter + "#" + std::to_string(realBst.getFrequency(iter)));
auto stKey = enc_engine->prf(iter + "#" + std::to_string(realBst.getFrequency(iter)));
readBatchMap[stKey] = iter;
storage_keys.push_back(stKey);
realBst.incrementFrequency(iter);
}

// std::cout << "D-r is " << D-operations.size() << std::endl;

for(int i=0;i<(D-operations.size());++i) {
auto fakeMinKey = fakeBst.getKeyWithMinFrequency();
auto stKey = enc_engine->prf(fakeMinKey + "#" + std::to_string(fakeBst.getFrequency(fakeMinKey)));
Expand All @@ -318,7 +321,12 @@ void waffle_proxy::execute_batch(const std::vector<operation> &operations, std::
// std::cout << "Querying key value pairs in execute_batch() new" << std::endl;
// for(int i=0;i<storage_keys.size();++i) {
// std::cout << "Getting response for " << i << "th key" << std::endl;
// std::cout << storage_interface->get(storage_keys[i]) << std::endl;
// if(keyValueMap.find(storage_keys[i]) != keyValueMap.end()) {
// std::cout << i << "th key is present " << std::endl;
// storage_interface->get(storage_keys[i]);
// } else {
// std::cout << "WARNING: " << i << "th key is not present " << std::endl;
// }
// }
auto responses = storage_interface->get_batch(storage_keys);
// std::cout << "Got key value pairs" << std::endl;
Expand Down
1 change: 1 addition & 0 deletions waffleClient/proxy/src/waffle_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class waffle_proxy : public proxy {
int s = 25;
int m = 50;
int redisBulkLength = 524287;
std::unordered_map<std::string, std::string> keyValueMap;

private:
void create_security_batch(std::shared_ptr<queue <std::pair<operation, std::shared_ptr<std::promise<std::string>>>>> &op_queue,
Expand Down

0 comments on commit a19d178

Please sign in to comment.