Skip to content

Instantly share code, notes, and snippets.

@tinnefeld
Created May 7, 2012 17:09
Show Gist options
  • Save tinnefeld/2629019 to your computer and use it in GitHub Desktop.
Save tinnefeld/2629019 to your computer and use it in GitHub Desktop.
RAMCloud Hello World Pseudo-Code
#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