Created
May 7, 2012 17:09
-
-
Save tinnefeld/2629019 to your computer and use it in GitHub Desktop.
RAMCloud Hello World Pseudo-Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "RamCloud.h" | |
#include <iostream> | |
int main(int argc, char const *argv[]) | |
{ | |
RAMCloud::RamCloud cloud("tcp:host=127.0.0.1,port=12246"); | |
const char * kTableName = "test_table"; | |
cloud.createTable(kTableName); | |
//debug("[+] Created table\n"); | |
const uint64_t tableId = cloud.getTableId(kTableName); | |
//debug("[+] Opened table id %u\n", tableId); | |
//write to RAMCloud, key "0" (which has the keylength 1) has the value HalloHPI | |
cloud.write(tableId, "0", 1, "HalloHPI"); | |
RAMCloud::Buffer value; | |
ramcloud->read(tableId, "0", 1, &value); | |
char buffer[200]; | |
value.copy(0, value.getTotalLength(), buffer); | |
std::cout << "Greetings from RAMCloud" << buffer << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment